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?