You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by Jarek Gawor <jg...@gmail.com> on 2010/04/14 22:54:04 UTC
Injection of (some) OSGi services into Java EE 6 apps
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