diff --git a/src/main/resources/spring/business-config.xml b/src/main/resources/spring/business-config.xml index 5e9dc688288be6b1d58321acb772cd89b2bfc142..99cf4c1d30949d713d253a70f44696e0e186a5f4 100644 --- a/src/main/resources/spring/business-config.xml +++ b/src/main/resources/spring/business-config.xml @@ -27,12 +27,12 @@ <!-- ================== 3 Profiles to choose from =================== - - default (uses JPA) - jdbc (uses Spring" JdbcTemplate) + - jpa - spring-data-jpa =============================================================================--> - <beans profile="default,spring-data-jpa"> + <beans profile="jpa,spring-data-jpa"> <!-- JPA EntityManagerFactory --> <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" p:dataSource-ref="dataSource"> @@ -80,7 +80,7 @@ <context:component-scan base-package="org.springframework.samples.petclinic.repository.jdbc"/> </beans> - <beans profile="default"> + <beans profile="jpa"> <!-- Loads JPA beans Will automatically be transactional due to @Transactional. diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index a70f3815ae67583b75fdc0c2fb900e9055d275a3..e080b6ecdaf86100dcb58c1b3b8f18fcade4342b 100644 --- a/src/main/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -10,11 +10,10 @@ http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" <context-param> <param-name>spring.profiles.active</param-name> - <param-value>default</param-value> + <param-value>jpa</param-value> </context-param> - <!-- Default profile is "jpa" (see business-config.xml for more details). - When using Spring JDBC, uncomment the following: --> + <!-- When using Spring JDBC, use the following: --> <!-- <context-param> <param-name>spring.profiles.active</param-name> <param-value>jdbc</param-value> diff --git a/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceJpaTests.java b/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceJpaTests.java index 2512372a4f4d9dcd6d844a909c9b64955d1978a0..e024f21fd09c37fb8e838e114872b8877fc41971 100644 --- a/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceJpaTests.java +++ b/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceJpaTests.java @@ -2,6 +2,7 @@ package org.springframework.samples.petclinic.service; import org.junit.runner.RunWith; +import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @@ -16,7 +17,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @ContextConfiguration(locations = {"classpath:spring/business-config.xml"}) @RunWith(SpringJUnit4ClassRunner.class) -// No active profile specificied because JPA uses the "default" profile +@ActiveProfiles("jpa") public class ClinicServiceJpaTests extends AbstractClinicServiceTests { } \ No newline at end of file