mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-16 12:55:50 +00:00
SPR-6447
+ added on the fly db configuration to all contexts + removed schema numbers to always pick the latest version
This commit is contained in:
parent
50b87ef75f
commit
8291c80122
4 changed files with 45 additions and 21 deletions
|
@ -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 @@
|
||||||
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 @@
|
||||||
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 @@
|
||||||
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 @@
|
||||||
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 @@
|
||||||
<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 @@
|
||||||
<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">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
Loading…
Reference in a new issue