• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Multiple annotation based context configuration

 
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm developing a spring based application which I'd like to organize in separated projects like follows:

books-service: provides all services binded to repositories working with some relational database
books-web: provides all controllers and web resources

books-service has a configuration using java class annotated with @Configuration which scans for br.com.books.service package
books-web has a configuration using java class annotated with @Configuration which scans for br.com.books.controller package

When I set the base package to @ComponentScan with br.com.books I have all requests being executed twice because beans were created twice.
So to solve this, I'm using @ComponentScan.Filter as follows:

Configuration for web app:


Configuration for services app:


So even using this configuration, my services are being executed twice.
Does anybody knows what's happening here?

Thanks in advance

Adolfo Eloy
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic