Skip to main content

@Resource inside JAX-RS-annotated bean

Please note these forums are being decommissioned and use the new and improved forums at
2 replies [Last post]
Joined: 2006-05-14

hello everyone,

i would like to know if anyone have success injecting a JDBC
datasource inside a JAX-RS resource.

Do i need to make the resources EJB's? or plain old java objects have
the benefit too?

thanks in advance

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-11-27

Dear sombriks

Did you find the right answer?

Joined: 2006-05-14


No i didn't.

For now i gave up to use only webprofile and added @Stateless annotation on JAX-RS along with @Path.

After that, the classes that i already mapped in my class got the right to use @Resource and @EJB to inject what i need just as if they where servlets... with the plus of being a EJB.

Zero xml configuration untill now, and thanks to JEE6 EJB's have no need to ejb-jar.xml or even an full featured EAR, they just live inside web project.

Of course, it will not run on ordinary and simpler tomcat, but it theory anything JEE6-compliant will run this .war