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
@PropertySource({ "classpath:persistence-mysql.properties" })
@ComponentScan({ "org.baeldung.persistence" })
public class PersistenceConfig {
public class PersistenceJPAConfig {
@Autowired
private Environment env;
public PersistenceConfig() {
public PersistenceJPAConfig() {
super();
}

View File

@ -1,17 +1,16 @@
package org.baeldung.spring;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@Configuration
// @Configuration
@EnableTransactionManagement
@ComponentScan({ "org.baeldung.persistence.dao", "org.baeldung.persistence.service" })
@ImportResource({ "classpath:hibernate4Config.xml" })
public class HibernateXmlConfig {
@ComponentScan({ "org.baeldung.persistence" })
@ImportResource({ "classpath:jpaConfig.xml" })
public class PersistenceJPAConfigXml {
public HibernateXmlConfig() {
public PersistenceJPAConfigXml() {
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.service.FooService;
import org.baeldung.spring.PersistenceConfig;
import org.baeldung.spring.PersistenceJPAConfig;
import org.junit.Test;
import org.junit.runner.RunWith;
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;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class)
@ContextConfiguration(classes = { PersistenceJPAConfig.class }, loader = AnnotationConfigContextLoader.class)
public class FooServicePersistenceIntegrationTest {
@Autowired