Results 1 to 2 of 2

Thread: What ApplicationContext has annotation DI support and hierarchical container feature?

  1. #1

    Lightbulb 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •