| ||
Component/s: | SpringCORE | |
Affects Version/s: | 1.2.5 | |
Fix Version/s: | None |
|
|
Virtual Machine: | Sun JVM - 1.4.2 |
Description | « Hide |
Spring cannot be used through JNDI. I have developped a Spring JNDI provider. It has been tested against Tomcat 4.1.31, WebLogic 8.1 and JBoss 3.2 and 4.0.
The principe is the following: if you want to load a Bean from an ApplicationContext, use the Bean name prefixed by spring:. In your jndi.properties, you shoud have set: java.naming.factory.url.pkgs=org.springframework.jndi and optionaly: org.springframework.jndi.url=path to the application context file definition. If this value is not specified, then the value is extracted from Context.URL (java.naming.provider.url). If none are found, the value of applicationContext.xml is used. So accessing a Bean from Spring is now done through the following code: MyInterface obj = (new InitialContext()).lookup(beanName); which make your application completely independant from Spring !!!! |