【发布时间】:2016-01-20 10:00:02
【问题描述】:
我正在使用最新的 Spring Boot (1.2.7.RELEASE)。我想使用 org.springframework.web.bind.annotation 包中的 @CrossOrigin 注释,如 Spring 文档中的 CORS Support 部分所述。
我想我已经拥有了所有必要的依赖项(通过 Spring Boot 默认设置),但这令人困惑:CrossOrigin 未找到,即使来自同一个包的 RestController 之类的东西也可以工作!
Error:(8, 47) java: cannot find symbol
symbol: class CrossOrigin
location: package org.springframework.web.bind.annotation
发生了什么事? CrossOrigin 是否已从 Spring-MVC 的更高版本中删除,还是我缺少一些依赖项?
pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
【问题讨论】:
标签: spring spring-mvc spring-boot cors