我已经使用以下Github上库设置我的春天启动工作区: https://github.com/leanstacks/spring-boot-fundamentals/tree/repository@CrossOrigin不能得到解决 - 春天开机
我成功地建立了REST API,同时也是能够测试使用邮差所有CRUD操作。 现在我试图从我的Angular 2应用程序调用Rest服务,但是当我执行GET操作时出现以下错误:
'http://localhost:8080/api/greetings。请求的资源上没有“Access-Control-Allow-Origin”标题。因此不允许访问'Origin'http://localhost:4200'。'
我试图使用: @CrossOrigin(methods = RequestMethod.GET,allowCredentials =“true”)注释解决交叉原点问题,但CrossOrigin没有得到解决。我收到一条消息: '导入org.springframework.web.bind.annotation.CrossOrigin无法解析'
任何建议/反馈都非常感谢。
它的工作!我实际上已经尝试过版本-1.4.1.RELEASE,但是导致JpaRepository无法解析。有什么理由呢? 顺便说一句,我已经有了春季启动启动网站。 谢谢ben75! :) – Malick