Spring @春季施工后给出的错误 @服务 公共类SystemPropertiesServiceImpl实现SystemPropertiesService { @自动连线 私有系统属性dao系统属性dao; 私有静态最终属性systemProperties=新属性()

Spring @春季施工后给出的错误 @服务 公共类SystemPropertiesServiceImpl实现SystemPropertiesService { @自动连线 私有系统属性dao系统属性dao; 私有静态最终属性systemProperties=新属性(),spring,Spring,@春季施工后给出的错误 @服务 公共类SystemPropertiesServiceImpl实现SystemPropertiesService { @自动连线 私有系统属性dao系统属性dao; 私有静态最终属性systemProperties=新属性(); @施工后 公共void loadSystemProperties(){ List allProperties=systemPropertiesDao.retrieveAll(); for(SystemProperties属性:allProp

@春季施工后给出的错误
@服务
公共类SystemPropertiesServiceImpl实现SystemPropertiesService
{
@自动连线
私有系统属性dao系统属性dao;
私有静态最终属性systemProperties=新属性();
@施工后
公共void loadSystemProperties(){
List allProperties=systemPropertiesDao.retrieveAll();
for(SystemProperties属性:allProperties)
{
put(property.getKey(),property.getValue());
}
String flag=systemProperties.getProperty(“flag,null”);
}
}
org.springframework.beans.factory.BeanCreationException:创建名为“EmailService”的bean时出错:自动关联依赖项注入失败;嵌套异常为org.springframework.beans.factory.BeanCreationException:无法自动关联字段:jm.gov.agd.common.service.SystemPropertiesService jm.gov.agd.common.service.impl.EmailServiceImpl.systemPropertiesService;嵌套异常为org.springframework.beans.factory.BeanCreationException:创建名为“systemPropertiesServiceImpl”的bean时出错:调用init方法失败;嵌套异常为org.springframework.orm.jpa.JpaSystemException:无法获取当前线程的事务同步会话;嵌套异常n为org.hibernate.HibernateException:无法获取当前线程的事务同步会话
在org.springframework.beans.factory.annotation.AutowiredNotationBeanPostProcessor.postProcessPropertyValues(AutowiredNotationBeanPostProcessor.java:334)~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.beans.factory.support.DefaultListableBeanFactory.PreInstanceSingleton(DefaultListableBeanFactory.java:772)~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)~[spring-context-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)~[spring-context-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
在org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
在org.springframework.boot.SpringApplication.run(SpringApplication.java:307)~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
在org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:98)[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
在org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)[spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)[spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
位于org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)[spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
位于org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)[spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)[spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228)[spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:230)[spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
位于org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)[spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
位于org.junit.internal.runners.model.ReflectVeCallable.run(reflectVeCallable.java:12)[junit-4.12.jar:4.12]
位于org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)[spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
位于org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:249)[spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
位于org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)[spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
在org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)[junit-4.12.jar:4.12]
在org.junit.runner
@Service
public class SystemPropertiesServiceImpl implements SystemPropertiesService 
{
  @Autowired
  private SystemPropertiesDao systemPropertiesDao;     

  private static final Properties systemProperties = new Properties();

  @PostConstruct
  public void loadSystemProperties(){
      List<SystemProperties> allProperties = systemPropertiesDao.retrieveAll();
      for ( SystemProperties propertie : allProperties)
      {
         systemProperties.put( propertie.getKey() , propertie.getValue()) ;
      }
      String flag = systemProperties.getProperty( "Flag,null );
  }
}

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'EmailService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: jm.gov.agd.common.service.SystemPropertiesService jm.gov.agd.common.service.impl.EmailServiceImpl.systemPropertiesService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'systemPropertiesServiceImpl': Invocation of init method failed; nested exception is org.springframework.orm.jpa.JpaSystemException: Could not obtain transaction-synchronized Session for current thread; nested exception is org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772) ~[spring-beans-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839) ~[spring-context-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307) ~[spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:98) [spring-boot-1.3.5.RELEASE.jar:1.3.5.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:230) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:249) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) [spring-test-4.2.6.RELEASE.jar:4.2.6.RELEASE]
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) [spring-test-4.2.6.RELEASE.jar:4.2.6 .RELEASE]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]...