Announcement Announcement Module
Collapse
No announcement yet.
application configuration and lookup bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • application configuration and lookup bean

    I have a two part question:

    1. What is the best way to configure a J2EE application if my context configuration xml file needs to located outside of WEB-INF? I am currently using:

    <servlet>
    <servlet-name>springapp</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <init-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:beanRefContext.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>

    2. I need to lookup (I can't use IoC) a bean that has been initialized and instantiated in question 1. I am currently using ContextSingletonBeanFactoryLocator to perform this lookup, but I noticed that ContextSingletonBeanFactoryLocator will reload my configuration file and reinstantiate my objects. This is bad for me. Is there a way to lookup an object in a bean factory that has already been instantiated?

    Thanks in advance,
    rzeng

  • #2
    2. I need to lookup (I can't use IoC) a bean that has been initialized and instantiated in question 1. I am currently using ContextSingletonBeanFactoryLocator to perform this lookup, but I noticed that ContextSingletonBeanFactoryLocator will reload my configuration file and reinstantiate my objects. This is bad for me. Is there a way to lookup an object in a bean factory that has already been instantiated?
    Yes, there is another way. If your class that needs to retrieve the instance from the application context has been loaded by the same class loader as the Spring application context you can use LocalInvokerProxyFactory/LocalInvokerServiceExporter. These are two classes I created for the purpose of retrieving instances loaded by the Spring application context in the same class loader. I'm currently finalizing the implementation and will release them as open-source shortly.

    Comment


    • #3
      Is there any early release code that you can supply? I urgently need to find a solution to this problem. Thanks in advance.

      rzeng

      Comment

      Working...
      X