Spring启用Cors启用休息服务

时间:2016-04-01 08:25:00

标签: spring-boot cors spring-web

我有一个弹簧休息服务,我想用CORS启用它。

其余的def就像:

Map<String, List<String>> maplist = new HashMap<String, List<String>>();
List<String> arraylist = new ArrayList<String>();
arraylist.add("Sample text"); // Add more strings...
maplist.put("key",arraylist); // Add more lists...

我从Chrome中调用此内容并检查网络活动。回应如下:

  

响应标头缓存控制:无存储,无缓存,必须重新验证,   max-age = 0 Content-Type:application / json; charset = UTF-8 Date:Fri,01 Apr   2016 08:15:57 GMT服务器:Apache-Coyote / 1.1 Transfer-Encoding:chunked   请求标题

     

请求标头接受: / 接受编码:gzip,deflate,sdch   Accept-Language:en-US,en; q = 0.8 Connection:keep-alive   主持人:本地主机:8080   引用者:http://localhost:8080/veloxity-dashboard-services/   User-Agent:Mozilla / 5.0(Windows NT 10.0; WOW64)AppleWebKit / 537.36   (KHTML,像Gecko一样)Chrome / 49.0.2623.110 Safari / 537.36

我的应用程序是在春季启动架构上。 spring-boot-starter-web和spring-boot-starter也包括在内。当我检查org.springframework.web.servlet.resource.ResourceHttpRequestHandle的getCorsConfiguration方法时,我看到返回对象是{}。

有什么想法吗?

0 个答案:

没有答案