Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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
 
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic