Spring JNDI provider

Spring JNDI provider

Created: 27/Oct/05 08:36 AM   Updated: 22/Jul/06 04:49 AM
Component/s: SpringCORE
Affects Version/s: 1.2.5
Fix Version/s: None

 

Time Tracking:
Not Specified

 

File Attachments: 1. Java Source File SpringContext.java (18 kb)
2. Java Source File SpringInitialContextFactory.java (3 kb)
3. Java Source File springURLContextFactory.java (4 kb)

 

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 !!!!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值