Answer the question
In order to leave comments, you need to log in
How to combine spring contexts into one?
Depending on how we create the beans, the context can be obtained via ClassPathXmlApplicationContext or AnnotationConfigApplicationContext.
But if the application uses two approaches (configuration of beans in xml and through annotations), then it turns out you need to work with two contexts. Is it possible to merge them or connect them one to another in order to get one context in which the beans were and those that are in xml and those that are configured with annotations?
Answer the question
In order to leave comments, you need to log in
There is an annotation @ImportResource("classpath:app-config.xml"), inside it, respectively, you write the path to xml with beans
They have a common parent - GenericApplicationContext, it's more flexible, look this way
Documentation Link
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question