双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

在Spring Boot中使用@CrossOrigin

weixin_38054042 weixin_38054042 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我正在使用最新的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>
...全文
评论 1
收藏 已收藏
分享
返回顶部