• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Problem with CORS in STS

 
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 14711
331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post your POM?
 
Alejandro Barrero
Ranch Hand
Posts: 502
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you
 
Stephan van Hulst
Saloon Keeper
Posts: 14711
331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will check it now. I'll respond to you later today.
 
Stephan van Hulst
Saloon Keeper
Posts: 14711
331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 14711
331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made a clean POM for you:
 
Bartender
Posts: 7488
171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A couple of cows to Stephan for the effort he put into these answers!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic