Results 1 to 3 of 3

Thread: Bean Loading Best Practices

  1. #1
    Join Date
    May 2007
    Posts
    1

    Default 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: http://www.springframework.org/docs/...ryLocator.html

    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. #2
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,425

    Default

    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 at 07:51 AM.
    Barracuda Networks SSL VPN Lead Developer
    http://pramatr.wordpress.com
    http://twitter.com/karldmoore
    http://www.linkedin.com/in/karldmoore
    Any postings are my own opinion, and should not be attributed to my employer or clients.

  3. #3
    Join Date
    Feb 2005
    Location
    Boston, MA
    Posts
    1,142

    Default

    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.
    Bill

Posting Permissions

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