Announcement Announcement Module
No announcement yet.
Bean Loading Best Practices Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bean Loading Best Practices

    I'm currently in the process of doing a Proof of Technology using Spring, Ibatis and JAX-WS.

    I really like springs features, and have started to get familiar with the various other features, including aop intercepts, and more.

    Right now I'm trying to figure out what the best practice is for the placement of my struts-context.xml files. My setup is very similar to the one found here:

    I have a DAO.jar which has some DI for Ibatis (or another framework).
    I have a BusinessUnit.jar which does some business logic, and has some DI for the DAO.
    And finally I have a Service.war file which depends on the BusinessUnit.jar.

    I've already managed to make everything work using one single applicationContext.xml file.

    However, I was wondering what the best practice was. Should I be putting a spring-context in each JAR specifying it's dependencies, and use beanRefFactory.xml? I've tried this approach but for some reason my aop:config section seems to be ignored.

    Thanks for the help!

  • #2
    I'm not sure there is really a best practice. I wouldn't split things up for the sake of it. If it makes sense for everything to be grouped keep it all together. If your context files are getting quite large split them up.
    Last edited by karldmoore; Aug 30th, 2007, 07:51 AM.


    • #3
      The Spring examples are good place to start. For a web application you can have a global context used for things like services, DAOs, etc, and then each servlet can have its own config file for things like controllers and other objects specific to the particular servlet.