Skip to content
Snippets Groups Projects
Commit 8291c801 authored by Costin Leau's avatar Costin Leau Committed by Mic
Browse files

SPR-6447

+ added on the fly db configuration to all contexts
+ removed schema numbers to always pick the latest version
parent 50b87ef7
No related branches found
No related tags found
No related merge requests found
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- ========================= RESOURCE DEFINITIONS ========================= --> <!-- ========================= RESOURCE DEFINITIONS ========================= -->
...@@ -22,10 +22,18 @@ ...@@ -22,10 +22,18 @@
for the required JAR files. Alternatively you can use another connection pool for the required JAR files. Alternatively you can use another connection pool
such as C3P0, similarly configured using Spring. such as C3P0, similarly configured using Spring.
--> -->
<bean id="dataSource" class="org.springframework.samples.petclinic.config.DbcpDataSourceFactory"
p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}"
p:username="${jdbc.username}" p:password="${jdbc.password}" p:populate="${jdbc.populate}"
p:schemaLocation="${jdbc.schemaLocation}" p:dataLocation="${jdbc.dataLocation}"/>
<!-- DataSource configuration for Apache Commons DBCP. -->
<!--
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}" p:username="${jdbc.username}" p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}" p:username="${jdbc.username}"
p:password="${jdbc.password}"/> p:password="${jdbc.password}"/>
-->
<!-- JNDI DataSource for JEE environments --> <!-- JNDI DataSource for JEE environments -->
<!-- <!--
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/petclinic"/> <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/petclinic"/>
......
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- ========================= RESOURCE DEFINITIONS ========================= --> <!-- ========================= RESOURCE DEFINITIONS ========================= -->
...@@ -32,6 +32,12 @@ ...@@ -32,6 +32,12 @@
p:username="${jdbc.username}" p:password="${jdbc.password}" p:populate="${jdbc.populate}" p:username="${jdbc.username}" p:password="${jdbc.password}" p:populate="${jdbc.populate}"
p:schemaLocation="${jdbc.schemaLocation}" p:dataLocation="${jdbc.dataLocation}"/> p:schemaLocation="${jdbc.schemaLocation}" p:dataLocation="${jdbc.dataLocation}"/>
<!-- DataSource configuration for Apache Commons DBCP. -->
<!--
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}" p:username="${jdbc.username}"
p:password="${jdbc.password}"/>
-->
<!-- JNDI DataSource for JEE environments --> <!-- JNDI DataSource for JEE environments -->
<!-- <!--
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/petclinic"/> <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/petclinic"/>
......
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation=" xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<!-- ========================= RESOURCE DEFINITIONS ========================= --> <!-- ========================= RESOURCE DEFINITIONS ========================= -->
...@@ -27,14 +27,24 @@ ...@@ -27,14 +27,24 @@
<context:property-placeholder location="classpath:jdbc.properties"/> <context:property-placeholder location="classpath:jdbc.properties"/>
<!-- <!--
Uses Apache Commons DBCP for connection pooling. See Commons DBCP documentation Spring FactoryBean that creates a DataSource using Apache Commons DBCP for connection
for the required JAR files. Alternatively you can use another connection pool pooling. See Commons DBCP documentation for the required JAR files. This factory bean
such as C3P0, similarly configured using Spring. can populate the data source with a schema and data scripts if configured to do so.
An alternate factory bean can be created for different connection pool implementations,
C3P0 for example.
--> -->
<bean id="dataSource" class="org.springframework.samples.petclinic.config.DbcpDataSourceFactory"
p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}"
p:username="${jdbc.username}" p:password="${jdbc.password}" p:populate="${jdbc.populate}"
p:schemaLocation="${jdbc.schemaLocation}" p:dataLocation="${jdbc.dataLocation}"/>
<!-- DataSource configuration for Apache Commons DBCP. -->
<!--
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"
p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}" p:username="${jdbc.username}" p:driverClassName="${jdbc.driverClassName}" p:url="${jdbc.url}" p:username="${jdbc.username}"
p:password="${jdbc.password}"/> p:password="${jdbc.password}"/>
-->
<!-- JNDI DataSource for JEE environments --> <!-- JNDI DataSource for JEE environments -->
<!-- <!--
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/petclinic"/> <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/petclinic"/>
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:oxm="http://www.springframework.org/schema/oxm"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd"> http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd">
<!-- <!--
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment