Pumpkin
Pumpkin

Reputation: 2043

Autowiring between separate projects

I have two projects namely A and B. Project A has a class C which has several global variables autowired. Project B has a class D which has to use an instance of class C for multiple purposes.

I would like to autowire the instance of C within the class D as defined in project A but keep in mind that D belongs to B.

Is there anyway I can achieve this ? For instance a way to say : " Project B, when trying to find out how to autowire classes consider the definitions and components that are defined in project A"

Upvotes: 0

Views: 969

Answers (1)

Ken Rimple
Ken Rimple

Reputation: 233

If you're mounting Spring JARs from other Spring projects, and you are using annotation scanning, then for your search path, you can use:

classpath*:com/my/base/package

That '*' in the classpath says search the entire class path, not just the classes in the JAR you're running out of.

Upvotes: 3

Related Questions