there is this property which must be in web.xml
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/cms</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
how use jndi settings in web.xml via hard coding by annotation?
I'm assuming here that you have configured the JNDI connection in context.xml. Assuming you have, then the answer is as simple as declaring a DataSource field and annotating it with an
@Resource
annotation that refers to yourjdbc/cms
JNDI name. Like so:Configuring it in the context.xml, if you haven't already, involves declaring a
<Resource />
with all the necessary parameters. Maybe like this: