Q:

@CrossOrigin cannot be resolved - Spring boot

I've setup my Spring boot workspace using the following Github repository: 
https://github.com/leanstacks/spring-boot-fundamentals/tree/repository
I successfully setup the Rest API and was also able to test all CRUD operations using Postman. 
Now I was trying to call the Rest services from my Angular 2 application, but I get the following error when I perform a GET operation:
'http://localhost:8080/api/greetings. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.'
I tried to use:
@CrossOrigin( methods = RequestMethod.GET, allowCredentials = "true") annotation for resolving the cross origin issue, but CrossOrigin isn't getting resolved. I get a message:
'The import org.springframework.web.bind.annotation.CrossOrigin cannot be resolved'
Any suggestion/feedback is very much appreciated.

A:

I suggest you to ensure to use the latest version of SpringBoot (in your pom.xml):
<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>1.4.2.RELEASE</version>
 </parent>

And also be sure to include the starter-web:
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    ...
</dependencies>

