Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring mvc Spring4/JUnit4嵌入式数据库未加载,可能是项目配置错误_Spring Mvc_Junit4_Hsqldb - Fatal编程技术网

Spring mvc Spring4/JUnit4嵌入式数据库未加载,可能是项目配置错误

Spring mvc Spring4/JUnit4嵌入式数据库未加载,可能是项目配置错误,spring-mvc,junit4,hsqldb,Spring Mvc,Junit4,Hsqldb,我以为我什么都有,但不是真的,所以我请求帮助 我有一个小型Spring4(WebMvc)项目,它在MySQL中的一个表上执行CRUD活动(在我的代码中是Location类)。我让它在Tomcat8上的Spring4正常工作,没有单元测试 现在我添加了单元测试,但无法正确配置JUnit。我认为我正确地设置了嵌入式HSQL数据库,但我的JUnit测试表明没有记录。我能找个人帮我纠正一下吗 该程序实际上并没有命名为“MyProgram”,路径也不是“mypackagepath”,但将内容编辑为可以缩短

我以为我什么都有,但不是真的,所以我请求帮助

我有一个小型Spring4(WebMvc)项目,它在MySQL中的一个表上执行CRUD活动(在我的代码中是Location类)。我让它在Tomcat8上的Spring4正常工作,没有单元测试

现在我添加了单元测试,但无法正确配置JUnit。我认为我正确地设置了嵌入式HSQL数据库,但我的JUnit测试表明没有记录。我能找个人帮我纠正一下吗

该程序实际上并没有命名为“MyProgram”,路径也不是“mypackagepath”,但将内容编辑为可以缩短内容。首先,以下是工作程序的配置部分:

@Configuration
@ComponentScan(basePackages = "mypackagepath")
@EnableWebMvc
public class MyProgramConfiguration extends WebMvcConfigurerAdapter { ... }

    @Override
    public void configureViewResolvers(ViewResolverRegistry registry) { ... }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) { ... }
}

@Configuration
@EnableTransactionManagement
@ComponentScan({ "mypackagepath.configuration" })
@PropertySource(value = { "classpath:application.properties" })
@EnableJpaRepositories(basePackages = { "mypackagepath.dao" })
public class JpaConfiguration {

    @Autowired
    private Environment environment;

    @Bean(name="entitymanagername")
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() { ... }

    @Bean
    public DataSource dataSource() { ... }

    @Bean
    public PlatformTransactionManager transactionManager(EntityManagerFactory emf) { ... }
}

public class SpringMvcInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    @Override
    protected Class<?>[] getRootConfigClasses() { ... }

    @Override
    protected Class<?>[] getServletConfigClasses() { ... }

    @Override
    protected String[] getServletMappings() { ... }

}
我在main/resources和test/resources目录中有一个application.properties文件。当然,“测试”具有HSQL属性

我相信没有加载记录(从fillLocationTableForTest.sql文件),因为我的MySQL版本的测试表中有很多记录(如果忽略了测试配置),而JUnit测试失败:

@Test
public final void testSummaryCountTotal() {
    Summary summary = summaryDao.getSummary();
    assertThat(summary.getCountTotal(), equalTo(12L));
}
这将返回java.lang.AssertionError:应为,但为

值得一提的是,在我的控制台中,我的JUnit运行为我提供了:

[main] INFO org.springframework.test.context.web.WebTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
[main] INFO org.springframework.test.context.web.WebTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@193948d, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1604f19, org.springframework.test.context.support.DirtiesContextTestExecutionListener@23a2f9, org.springframework.test.context.transaction.TransactionalTestExecutionListener@c0edeb, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@17e2f02]
[main] INFO org.springframework.web.context.support.GenericWebApplicationContext - Refreshing org.springframework.web.context.support.GenericWebApplicationContext@dd8682: startup date [Tue Feb 09 03:51:34 CST 2016]; root of context hierarchy
[main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'dataSource': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=jpaConfiguration; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [mypackagepath/configuration/JpaConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=testJpaConfiguration; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in mypackagepath.configuration.TestJpaConfiguration]
[main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'exceptionTranslation': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=jpaConfiguration; factoryMethodName=exceptionTranslation; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [mypackagepath/configuration/JpaConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=testJpaConfiguration; factoryMethodName=exceptionTranslation; initMethodName=null; destroyMethodName=(inferred); defined in mypackagepath.configuration.TestJpaConfiguration]
[main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'myentitymanagername': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=jpaConfiguration; factoryMethodName=entityManagerFactory; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [mypackagepath/configuration/JpaConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=testJpaConfiguration; factoryMethodName=entityManagerFactoryBean; initMethodName=null; destroyMethodName=(inferred); defined in mypackagepath.configuration.TestJpaConfiguration]
[main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'transactionManager': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=jpaConfiguration; factoryMethodName=transactionManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [mypackagepath/configuration/JpaConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=testJpaConfiguration; factoryMethodName=transactionManager; initMethodName=null; destroyMethodName=(inferred); defined in mypackagepath.configuration.TestJpaConfiguration]

[main] INFO org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'testJpaConfiguration' of type [class mypackagepath.configuration.TestJpaConfiguration$$EnhancerBySpringCGLIB$$d9ae76ba] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[main] INFO org.springframework.jdbc.datasource.DriverManagerDataSource - Loaded JDBC driver: org.hsqldb.jdbcDriver
[main] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'myentitymanagername'
INFO : org.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [
    name: myentitymanagername
    ...]
INFO : org.hibernate.Version - HHH000412: Hibernate Core {4.3.6.Final}
INFO : org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found
INFO : org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist
INFO : org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
INFO : org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
INFO : org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
INFO : org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.1.3.Final
INFO : org.hibernate.type.BasicTypeRegistry - HHH000270: Type registration [java.util.Currency] overrides previous : org.hibernate.type.CurrencyType@1ffa30b
INFO : org.hibernate.tool.hbm2ddl.SchemaExport - HHH000227: Running hbm2ddl schema export
INFO : org.hibernate.tool.hbm2ddl.SchemaExport - HHH000230: Schema export complete
[main] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'myentitymanagername'
INFO : org.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [
    name: myentitymanagername
    ...]

INFO : org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
INFO : org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
INFO : org.hibernate.type.BasicTypeRegistry - HHH000270: Type registration [java.util.Currency] overrides previous : org.hibernate.type.CurrencyType@1ffa30b
INFO : org.hibernate.tool.hbm2ddl.SchemaExport - HHH000227: Running hbm2ddl schema export
INFO : org.hibernate.tool.hbm2ddl.SchemaExport - HHH000230: Schema export complete
WARN : org.hibernate.jpa.internal.EntityManagerFactoryRegistry - HHH000436: Entity manager factory name (myentitymanagername) is already registered.  If entity manager will be clustered or passivated, specify a unique value for property 'hibernate.ejb.entitymanager_factory_name'
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[//location/{id}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}" onto public org.springframework.http.ResponseEntity<mypackagepath.model.Location> mypackagepath.controller.LocationController.getEdit(java.lang.Long)
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[//location/{id}],methods=[PUT],params=[],headers=[],consumes=[application/json],produces=[application/json],custom=[]}" onto public org.springframework.http.ResponseEntity<mypackagepath.model.Location> mypackagepath.controller.LocationController.putEdit(mypackagepath.model.Location,java.lang.Long)
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[//next/{id}/type/{type}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}" onto public org.springframework.http.ResponseEntity<mypackagepath.model.Location> mypackagepath.controller.LocationController.getNextEdit(java.lang.Long,java.lang.String)
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/main],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String mypackagepath.controller.MainController.getMainPage()
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[//address/{address}/{key}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}" onto public org.springframework.http.ResponseEntity<java.lang.String> mypackagepath.controller.ProxyAccessController.getAddress(java.lang.String,java.lang.String)
[main] INFO org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/static/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for @ControllerAdvice: org.springframework.web.context.support.GenericWebApplicationContext@dd8682: startup date [Tue Feb 09 03:51:34 CST 2016]; root of context hierarchy
[Thread-1] INFO org.springframework.web.context.support.GenericWebApplicationContext - Closing org.springframework.web.context.support.GenericWebApplicationContext@dd8682: startup date [Tue Feb 09 03:51:34 CST 2016]; root of context hierarchy
[Thread-1] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'myentitymanagername'
[main]INFO org.springframework.test.context.web.WebTestContextBootstrapper-从位置[META-INF/spring.factories]加载默认TestExecutionListener类名:[org.springframework.test.context.web.ServletTestExecutionListener,org.springframework.test.context.support.DirtiesContextTestExecutionListener,org.springframework.test.context.transaction.TransactionalTestExecutionListener,org.springframework.test.context.jdbc.SqlscriptstexecutionListener]
[main]INFO org.springframework.test.context.web.WebTestContextBootstrapper-使用TestExecutionListeners:[org.springframework.test.context.web。ServletTestExecutionListener@193948d,org.springframework.test.context.support。DependencyInjectionTestExecutionListener@1604f19,org.springframework.test.context.support。DirtiesContextTestExecutionListener@23a2f9,org.springframework.test.context.transaction。TransactionalTestExecutionListener@c0edeb,org.springframework.test.context.jdbc。SqlScriptsTestExecutionListener@17e2f02]
[main]INFO org.springframework.web.context.support.GenericWebApplicationContext-刷新org.springframework.web.context.support。GenericWebApplicationContext@dd8682:启动日期[Tue Feb 09 03:51:34 CST 2016];上下文层次结构的根
[main]INFO org.springframework.beans.factory.support.DefaultListableBeanFactory-重写bean“数据源”的bean定义:替换[Root bean:class[null];scope=;abstract=false;lazyInit=false;autowireMode=3;dependencyCheck=0;autowireCandidate=true;primary=false;factoryBeanName=JPA配置;factoryMethodName=dataSource;initMethodName=null;destroyMethodName=(推断);在类路径资源[mypackagepath/configuration/JPA配置.class]中定义,带有[Root bean:class[null];scope=;abstract=false;lazyInit=false;autowireMode=3;dependencyCheck=0;autowireCandidate=true;primary=false;factoryBeanName=TestJPA配置;factoryMethodName=dataSource;initMethodName=null;destroyMethodName=(推断);在mypackagepath.configuration.TestJPA配置中定义]
[main]INFO org.springframework.beans.factory.support.DefaultListableBeanFactory-重写bean“exceptionTranslation”的bean定义:替换[Root bean:class[null];scope=;abstract=false;lazyInit=false;autowireMode=3;dependencyCheck=0;autowireCandidate=true;primary=false;factoryBeanName=jpaConfiguration;factoryMethodName=exceptionTranslation;initMethodName=null;destroyMethodName=(推断);在类路径资源[mypackagepath/configuration/jpaConfiguration.class]中使用[Root bean:class]定义[null];scope=;abstract=false;lazyInit=false;autowireMode=3;dependencyCheck=0;autowireCandidate=true;primary=false;factoryBeanName=TestJPA配置;factoryMethodName=exceptionTranslation;initMethodName=null;destroyMethodName=(推断);在mypackagepath.configuration.TestJPA配置中定义]
[main]INFO org.springframework.beans.factory.support.DefaultListableBeanFactory-重写bean'myentitymanagername'的bean定义:替换[Root bean:class[null];scope=;abstract=false;lazyInit=false;autowireMode=3;dependencyCheck=0;autowireCandidate=true;primary=false;factoryBeanName=jpaConfiguration;factoryMethodName=entityManagerFactory;initMethodName=null;destroyMethodName=(推断);在类路径资源[mypackagepath/configuration/jpaConfiguration.class]中使用[Root bean:class]定义[null];scope=;abstract=false;lazyInit=false;autowireMode=3;dependencyCheck=0;autowireCandidate=true;primary=false;factoryBeanName=TestJPA配置;factoryMethodName=entityManagerFactoryBean;initMethodName=null;destroyMethodName=(推断);在mypackagepath.configuration.TestJPA配置中定义]
[main]INFO org.springframework.beans.factory.support.DefaultListableBeanFactory-重写bean“transactionManager”的bean定义:替换[Root bean:class[null];scope=;abstract=false;lazyInit=false;autowireMode=3;dependencyCheck=0;autowireCandidate=true;primary=false;factoryBeanName=jpaConfiguration;factoryMethodName=transactionManager;initMethodName=null;destroyMethodName=(推断);在类路径资源[mypackagepath/configuration/jpaConfiguration.class]中使用[Root bean:class]定义[null];scope=;abstract=false;lazyInit=false;autowireMode=3;dependencyCheck=0;autowireCandidate=true;primary=false;factoryBeanName=TestJPA配置;factoryMethodName=transactionManager;initMethodName=null;destroyMethodName=(推断);在mypackagepath.configuration.TestJPA配置中定义]
[main]INFO org.springframework.context.support.PostProcessorRegi
[main] INFO org.springframework.test.context.web.WebTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener]
[main] INFO org.springframework.test.context.web.WebTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@193948d, org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1604f19, org.springframework.test.context.support.DirtiesContextTestExecutionListener@23a2f9, org.springframework.test.context.transaction.TransactionalTestExecutionListener@c0edeb, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@17e2f02]
[main] INFO org.springframework.web.context.support.GenericWebApplicationContext - Refreshing org.springframework.web.context.support.GenericWebApplicationContext@dd8682: startup date [Tue Feb 09 03:51:34 CST 2016]; root of context hierarchy
[main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'dataSource': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=jpaConfiguration; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [mypackagepath/configuration/JpaConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=testJpaConfiguration; factoryMethodName=dataSource; initMethodName=null; destroyMethodName=(inferred); defined in mypackagepath.configuration.TestJpaConfiguration]
[main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'exceptionTranslation': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=jpaConfiguration; factoryMethodName=exceptionTranslation; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [mypackagepath/configuration/JpaConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=testJpaConfiguration; factoryMethodName=exceptionTranslation; initMethodName=null; destroyMethodName=(inferred); defined in mypackagepath.configuration.TestJpaConfiguration]
[main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'myentitymanagername': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=jpaConfiguration; factoryMethodName=entityManagerFactory; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [mypackagepath/configuration/JpaConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=testJpaConfiguration; factoryMethodName=entityManagerFactoryBean; initMethodName=null; destroyMethodName=(inferred); defined in mypackagepath.configuration.TestJpaConfiguration]
[main] INFO org.springframework.beans.factory.support.DefaultListableBeanFactory - Overriding bean definition for bean 'transactionManager': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=jpaConfiguration; factoryMethodName=transactionManager; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [mypackagepath/configuration/JpaConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=testJpaConfiguration; factoryMethodName=transactionManager; initMethodName=null; destroyMethodName=(inferred); defined in mypackagepath.configuration.TestJpaConfiguration]

[main] INFO org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'testJpaConfiguration' of type [class mypackagepath.configuration.TestJpaConfiguration$$EnhancerBySpringCGLIB$$d9ae76ba] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[main] INFO org.springframework.jdbc.datasource.DriverManagerDataSource - Loaded JDBC driver: org.hsqldb.jdbcDriver
[main] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'myentitymanagername'
INFO : org.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [
    name: myentitymanagername
    ...]
INFO : org.hibernate.Version - HHH000412: Hibernate Core {4.3.6.Final}
INFO : org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found
INFO : org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist
INFO : org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
INFO : org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
INFO : org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
INFO : org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.1.3.Final
INFO : org.hibernate.type.BasicTypeRegistry - HHH000270: Type registration [java.util.Currency] overrides previous : org.hibernate.type.CurrencyType@1ffa30b
INFO : org.hibernate.tool.hbm2ddl.SchemaExport - HHH000227: Running hbm2ddl schema export
INFO : org.hibernate.tool.hbm2ddl.SchemaExport - HHH000230: Schema export complete
[main] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'myentitymanagername'
INFO : org.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [
    name: myentitymanagername
    ...]

INFO : org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.HSQLDialect
INFO : org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
INFO : org.hibernate.type.BasicTypeRegistry - HHH000270: Type registration [java.util.Currency] overrides previous : org.hibernate.type.CurrencyType@1ffa30b
INFO : org.hibernate.tool.hbm2ddl.SchemaExport - HHH000227: Running hbm2ddl schema export
INFO : org.hibernate.tool.hbm2ddl.SchemaExport - HHH000230: Schema export complete
WARN : org.hibernate.jpa.internal.EntityManagerFactoryRegistry - HHH000436: Entity manager factory name (myentitymanagername) is already registered.  If entity manager will be clustered or passivated, specify a unique value for property 'hibernate.ejb.entitymanager_factory_name'
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[//location/{id}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}" onto public org.springframework.http.ResponseEntity<mypackagepath.model.Location> mypackagepath.controller.LocationController.getEdit(java.lang.Long)
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[//location/{id}],methods=[PUT],params=[],headers=[],consumes=[application/json],produces=[application/json],custom=[]}" onto public org.springframework.http.ResponseEntity<mypackagepath.model.Location> mypackagepath.controller.LocationController.putEdit(mypackagepath.model.Location,java.lang.Long)
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[//next/{id}/type/{type}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}" onto public org.springframework.http.ResponseEntity<mypackagepath.model.Location> mypackagepath.controller.LocationController.getNextEdit(java.lang.Long,java.lang.String)
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/main],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String mypackagepath.controller.MainController.getMainPage()
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[//address/{address}/{key}],methods=[GET],params=[],headers=[],consumes=[],produces=[application/json],custom=[]}" onto public org.springframework.http.ResponseEntity<java.lang.String> mypackagepath.controller.ProxyAccessController.getAddress(java.lang.String,java.lang.String)
[main] INFO org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/static/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
[main] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for @ControllerAdvice: org.springframework.web.context.support.GenericWebApplicationContext@dd8682: startup date [Tue Feb 09 03:51:34 CST 2016]; root of context hierarchy
[Thread-1] INFO org.springframework.web.context.support.GenericWebApplicationContext - Closing org.springframework.web.context.support.GenericWebApplicationContext@dd8682: startup date [Tue Feb 09 03:51:34 CST 2016]; root of context hierarchy
[Thread-1] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'myentitymanagername'
@Bean(destroyMethod = "shutdown")    
public DataSource dataSource() {
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
    EmbeddedDatabase db = builder
        .setType(EmbeddedDatabaseType.HSQL)
        //.addScript(createLocationTableScript)
        //.addScript(fillLocationTableScript)
        .build();

    return db;
}
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { TestJpaConfiguration.class }, loader = AnnotationConfigWebContextLoader.class)
@WebAppConfiguration
public class SummaryDaoTest {

    @Value("classpath:createLocationTableForTest.sql")
    private String createLocationTableScript;

    @Value("classpath:fillLocationTableForTest.sql")
    private String fillLocationTableScript;

    @Autowired
    private EmbeddedDatabase db;

    @Autowired
    private SummaryDao summaryDao;

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
    }

    @Before
    public void setUp() throws Exception {
    db = new EmbeddedDatabaseBuilder()
            .setType(EmbeddedDatabaseType.HSQL)
            .addScript(createLocationTableScript)
            .addScript(fillLocationTableScript)
            .build();
    }

    @After
    public void tearDown() throws Exception {
        db.shutdown();
    }

    // After this come the tests...

}