Hello all,
I'm new to spring, so forgive the basic question, but I can't find the answer in either of the books on my desk, or in google.
I have a basic "Hello World" SLSB EJB which I am testing a simple client. The client contains the horrible code:
Using Spring, I still want to get these JNDI properties (the factory and the URL) into my application to tell it to use my JNDI. No clues from the books, but I finally figured to create a JndiTemplate and set autowire on the bean defining the SLSB proxy.Code:Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, weblogic.jndi.T3InitialContextFactory"); p.put(Context.PROVIDER_URL, url); return new InitialContext(p);
What I am wondering is, is this the correct approach, or is there some way of setting the "default" JndiTemplate in the framework and avoiding injecting the template into each bean using autowire (or maybe a different method).Code:<bean id="helloWorld" autowire="byName" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean"> ... etc ... <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate"> <property name="environment"> <props> <prop key="java.naming.factory.initial">weblogic.jndi.WLInitialContextFactory </prop> <prop key="java.naming.provider.url">t3://localhost:7001</prop> </props> </property> </bean>
thanks
Richard


Reply With Quote