On 11/01/2011 09:19 AM, Riccardo Cohen wrote:
> Hello
> I'm migrating an application from resin v3.2.1 to v4.0.13.
> In the old conf there were 2<database> tags pointing to 2 different db
> servers, each with a different<jndi-name>
>
> Now in v4, @Named is replaced with @Inject, but there is no attribute to
> set the jndi-name :
>
> before :
>
> @Named("realty/jdbc") public DataSource m_datasource;// high priority
> @Named("realty/jdbclow") public DataSource m_datasourcelow;// low
> priority
>
> after :
>
> @Inject public DataSource m_datasource;// high priority
> @Inject public DataSource m_datasourcelow;// low priority
>
>
> I've googled and searched the doc, and did not find any way to tell
> resin to use the good jndi-name.
> Is there any way to do so ?
Well, there are a few things.
First, you always need an @Inject. If you have a @Named, you need
something like:
@Inject @Named("reality/jdbc") public DataSource m_datasource;
Second, @Named isn't the same as jndi; it's a CDI name not a JNDI name.
I did just check, and Resin's <database jndi-name="..."> does
automatically set a @Named as well as the JNDI, but that's specific to
<database>
More generally, you could use a ee:Named="foo"
<database ee:Named="foo" xmlns:ee="urn:java:ee">
The Named attribute is the same as @Named (the urn:java:ee is a search
path like a classpath, which includes javax.inject.*, which is the
package of javax.inject.Named.)
-- Scott
> Thanks a lot.
>
_______________________________________________
resin-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/resin-interest