Announcement Announcement Module
Collapse
No announcement yet.
What ApplicationContext has annotation DI support and hierarchical container feature? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • What ApplicationContext has annotation DI support and hierarchical container feature?

    I have written an application using Spring Framework. The application was created over 3 different ApplicationContext(s) linked in a simple hierarchical way using ClassPathXmlApplicationContext. After testing the functionality of the application, I am now ready to integrate it into a web server using Spring MVC.

    My challenge is to choose the right ApplicationContext class. It would seem like the natural choice would be to use AnnotationConfigApplicationContext or AnnotationConfigWebApplicationContext because I wish to use the annotation dependency injection features but I see that both of these classes are standalone, that is they can't be linked in a hierachical way.

    QUESTION: What choice of ApplicationContext class should I use for my webserver given that I want to keep my backend application in 3 different ApplicationContext classes (the same ClassPathXmlApplicationContext) linked in a hierarchical way?

    PS: I am hoping that my webserver application will be on 4 different ApplicationContext classes: 1 for the webserver front-end + 3 others for the backend functionality.

  • #2
    What ApplicationContext has annotation DI support and hierarchical container feature
    All shipped application contexts.

    You can always set the parent by using the setter method (setParent). All containers support annotation based DI (not sure what makes you think they don't). When you use component-scanning this is on by default, if not simply add context:annotation-config to your configuration.

    Comment

    Working...
    X