This commit is contained in:
eugenp 2013-05-31 23:15:06 +03:00
parent 210be2e573
commit 829521b212
4 changed files with 9 additions and 10 deletions

View File

@ -25,12 +25,12 @@ import com.google.common.base.Preconditions;
@EnableTransactionManagement @EnableTransactionManagement
@PropertySource({ "classpath:persistence-mysql.properties" }) @PropertySource({ "classpath:persistence-mysql.properties" })
@ComponentScan({ "org.baeldung.persistence" }) @ComponentScan({ "org.baeldung.persistence" })
public class PersistenceConfig { public class PersistenceJPAConfig {
@Autowired @Autowired
private Environment env; private Environment env;
public PersistenceConfig() { public PersistenceJPAConfig() {
super(); super();
} }

View File

@ -1,17 +1,16 @@
package org.baeldung.spring; package org.baeldung.spring;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource; import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration // @Configuration
@EnableTransactionManagement @EnableTransactionManagement
@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" }) @ComponentScan({ "org.baeldung.persistence" })
@ImportResource({ "classpath:hibernate4Config.xml" }) @ImportResource({ "classpath:jpaConfig.xml" })
public class HibernateXmlConfig { public class PersistenceJPAConfigXml {
public HibernateXmlConfig() { public PersistenceJPAConfigXml() {
super(); super();
} }

View File

@ -4,7 +4,7 @@ import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
import org.baeldung.persistence.model.Foo; import org.baeldung.persistence.model.Foo;
import org.baeldung.persistence.service.FooService; import org.baeldung.persistence.service.FooService;
import org.baeldung.spring.PersistenceConfig; import org.baeldung.spring.PersistenceJPAConfig;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -15,7 +15,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.support.AnnotationConfigContextLoader; import org.springframework.test.context.support.AnnotationConfigContextLoader;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) @ContextConfiguration(classes = { PersistenceJPAConfig.class }, loader = AnnotationConfigContextLoader.class)
public class FooServicePersistenceIntegrationTest { public class FooServicePersistenceIntegrationTest {
@Autowired @Autowired