I have a project A. This project is created to be a dependency for project B. But, in project A I have a spring @Configuration class, for junit testing, etc. When I build my jar for project A and add it as a dependency for B, B sees all my A's configuration classes, and begins complaining. So I have to comment @Configuration annotations is A, rebuild my libs and add them again, but it's not a good way. How to explain to project B's spring that it should not see @Configuration classes in project A`s lib. I think I need to deal with packages and component-scan, but how to do it properly?
Asked
Active
Viewed 79 times
1 Answers
1
One way is to not scan project A's packages from project B, but this requires packages from both projects to not overlap.
If packages from both projects overlap, then you should use ComponentScan.excludeFilters
. See this SO answer for an example.