This week's book giveaway is in the Beginning Java forum.
We're giving away four copies of Murach's Java Programming and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with CORS in STS  RSS feed

 
Alejandro Barrero
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
STS cannot find the annotation @CrossOrigin in a Maven application; I have tried a few dependencies in the pom but to no avail. Now I am trying with code

but it still doesn't work.
Lately I added

But STS cannot find CorsRegistry.
 
Stephan van Hulst
Saloon Keeper
Posts: 7473
134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your POM?
 
Alejandro Barrero
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
Stephan van Hulst
Saloon Keeper
Posts: 7473
134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will check it now. I'll respond to you later today.
 
Stephan van Hulst
Saloon Keeper
Posts: 7473
134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the late reply.

Remove the spring-core and spring-web and spring-context dependencies from your POM and upgrade the version of <org.springframework-version> to something like 4.3.10.RELEASE.

Add the following underneath your <dependencies> node:

Putting spring-context under dependencyManagement means: "I don't directly depend on spring-context, but if one of my direct dependencies does, make sure to exclude commons-logging".

You should try to make your dependency graph a tree as much as possible. I removed spring-core, spring-web and spring-context because they are already transitive dependencies from spring-webmvc, and they're causing version conflicts.

You should also move log4j under dependency management, and remove the <version> element.
 
Stephan van Hulst
Saloon Keeper
Posts: 7473
134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made a clean POM for you:
 
Tim Moores
Saloon Keeper
Posts: 3755
78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A couple of cows to Stephan for the effort he put into these answers!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!