Skip to content
Snippets Groups Projects
Commit 7b16cb82 authored by michaelisvy's avatar michaelisvy
Browse files

Merge pull request #23 from cyrille-leclerc/master

Introduce a "jee" Spring profile to retrieve the datasource with a JNDI lookup
parents 6942397e 2eaf4983
No related branches found
No related tags found
No related merge requests found
...@@ -6,12 +6,15 @@ ...@@ -6,12 +6,15 @@
xmlns:p="http://www.springframework.org/schema/p" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee.xsd">
<!-- ========================= DATASOURCE DEFINITION ========================= --> <!-- ========================= DATASOURCE DEFINITION ========================= -->
...@@ -26,11 +29,6 @@ ...@@ -26,11 +29,6 @@
p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}" p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}"
p:username="${jdbc.username}" p:password="${jdbc.password}"/> p:username="${jdbc.username}" p:password="${jdbc.password}"/>
<!-- JNDI DataSource for JEE environments -->
<!--
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/petclinic"/>
-->
<!-- Database initializer. If any of the script fails, the initialization stops. --> <!-- Database initializer. If any of the script fails, the initialization stops. -->
<!-- As an alternative, for embedded databases see <jdbc:embedded-database/>. --> <!-- As an alternative, for embedded databases see <jdbc:embedded-database/>. -->
<jdbc:initialize-database data-source="dataSource"> <jdbc:initialize-database data-source="dataSource">
...@@ -38,4 +36,8 @@ ...@@ -38,4 +36,8 @@
<jdbc:script location="${jdbc.dataLocation}"/> <jdbc:script location="${jdbc.dataLocation}"/>
</jdbc:initialize-database> </jdbc:initialize-database>
<beans profile="javaee" >
<!-- JNDI DataSource for JEE environments -->
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/petclinic"/>
</beans>
</beans> </beans>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment