【发布时间】:2017-02-14 09:38:42
【问题描述】:
我正在阅读这个Spring security tutorial,它提到我们可能会看到 2 个动态资源请求,因为这个控制器有一个 CORS 协商:
@SpringBootApplication
@RestController
public class UiApplication {
@RequestMapping("/resource")
public Map<String,Object> home() {
Map<String,Object> model = new HashMap<String,Object>();
model.put("id", UUID.randomUUID().toString());
model.put("content", "Hello World");
return model;
}
public static void main(String[] args) {
SpringApplication.run(UiApplication.class, args);
}
}
只是好奇@RestController注解是否默认启用CORS?
【问题讨论】:
标签: java spring rest spring-mvc spring-boot