geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jarek Gawor <jga...@gmail.com>
Subject Injection of (some) OSGi services into Java EE 6 apps
Date Wed, 14 Apr 2010 20:54:04 GMT
Hi all,

FYI, since the @Resource.lookup support appears to be working you
should be able to inject some types of OSGi services directly into
Java EE 6 applications without any additional configuration. For
example, you should be able to inject a data source for the system
database using the following:

@Resource(lookup="osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=org.apache.geronimo.configs/system-database/JCAConnectionManager/SystemDatasource")
private DataSource myDataSource;

Of course, the jndi url in the lookup attribute can be any of the jndi
schemes that we support in Geronimo. I used the 'osgi' scheme to just
demonstrate the integration between Java EE 6 features and the OSGi
JNDI Services spec.

Jarek

Mime
View raw message