Announcement Announcement Module
Collapse
No announcement yet.
Injecting dependencies possibly by scanning but not knowing the package Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Injecting dependencies possibly by scanning but not knowing the package

    Hi,

    I need to inject dependencies in class A with instances of interface B.

    like so:

    public class A{
    @Autowired private B dependency;

    // Remainder of of A definition
    }

    Class A is in Maven module M1. I will create instances on B in Maven module M2. M2 depends on M1 although the spring xml configuration must be in M1. I do not know to what packages the implementation of B will belong to in advance so I cannot set the component scan base package. Is there any alternative way so that the application container defined using the configuration in M1 can scan and/or create beans form the implementations in M2?

    Thanks in advance,

    Luigi
Working...
X