Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple annotation based context configuration

 
Adolfo Eloy
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic