jpa work
This commit is contained in:
parent
210be2e573
commit
829521b212
|
@ -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();
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue