Announcement Announcement Module
No announcement yet.
ApplicationContext in Business Objects Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • ApplicationContext in Business Objects

    Can someone give me some best practices for obtaining an ApplicationContext from within a Business Object. I have a struts web application which leverages the ContextListener stuff, but that is for "Action" classes. What do I do in my Business Object which needs access to another business object defined in Spring? I have an "order" business object which needs access to a "shipping calculator" business object, both defined in spring, but not a part of the action. Is it best to use ThreadLocal variables integrated with ContextListener, is it best to stor the ApplicationContext in JNDI? What is the best approach? How do I hook Business objects with Spring?

  • #2
    The best way is to have a setter for "shipping calculator" in your "order" object, then set that from your application context definition file.