You can use the same bean definition file in production and test. Assume this is your bean definition in production:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:comp/env/jdbc/DataSource"/> </bean> <bean id="dao" class="my.Dao"> <property name="dataSource" ref="dataSource" /> </bean>
First you have to define a org.osjava.sj.root directory containing jdbc/DataSource.properties. DataSource.properties should somehow look like
org.osjava.sj.root
type = javax.sql.DataSource driverClassName = org.gjt.mm.mysql.Driver url = jdbc:mysql://localhost/testdb username = user_name password = password
To prefix "jdbc/DataSource" with "java:comp/env" set org.osjava.sj.space = java:comp/env. That's it.
org.osjava.sj.space = java:comp/env
There was an error while loading. Please reload this page.