我有一个web应用程序是Hibernate 4.3.7和Spring Boot 1.2.0。释放我不做JPA。我使用直接Hibernate会话工厂,hbm。xmls等。
出于某种原因,Spring Boot一直试图自动加载JPA内容。我为我的Spring LocalSessionFactory创建了一个别名,名为"entityManagerFactory",并关闭了一个错误。现在,它又在这上面爆炸了。如何在Spring Boot中完全关闭所有JPA自动加载内容?
2015-01-02 16:51:20,147 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] (main) Creating shared instance of singleton bean 'openEntityManagerInViewInterceptor' 2015-01-02 16:51:20,147 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] (main) Creating instance of bean 'openEntityManagerInViewInterceptor' 2015-01-02 16:51:20,147 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] (main) Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor' 2015-01-02 16:51:20,147 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] (main) Returning cached instance of singleton bean 'org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration$JpaWebConfiguration' 2015-01-02 16:51:20,160 DEBUG [org.springframework.beans.factory.support.DefaultListableBeanFactory] (main) Eagerly caching bean 'openEntityManagerInViewInterceptor' to allow for resolving potential circular references 2015-01-02 16:51:20,160 TRACE [org.springframework.beans.CachedIntrospectionResults] (main) Getting BeanInfo for class [org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor] 2015-01-02 16:51:20,223 TRACE [org.springframework.beans.CachedIntrospectionResults] (main) Caching PropertyDescriptors for class [org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor] 2015-01-02 16:51:20,223 TRACE [org.springframework.beans.CachedIntrospectionResults] (main) Found bean property 'beanFactory' of type [org.springframework.beans.factory.BeanFactory] 2015-01-02 16:51:20,223 TRACE [org.springframework.beans.CachedIntrospectionResults] (main) Found bean property 'class' of type [java.lang.Class] 2015-01-02 16:51:20,223 TRACE [org.springframework.beans.CachedIntrospectionResults] (main) Found bean property 'entityManagerFactory' of type [javax.persistence.EntityManagerFactory] 2015-01-02 16:51:20,223 TRACE [org.springframework.beans.CachedIntrospectionResults] (main) Found bean property 'jpaProperties' of type [java.util.Properties] 2015-01-02 16:51:20,223 TRACE [org.springframework.beans.CachedIntrospectionResults] (main) Found bean property 'jpaPropertyMap' of type [java.util.Map] 2015-01-02 16:51:20,223 TRACE [org.springframework.beans.CachedIntrospectionResults] (main) Found bean property 'persistenceUnitName' of type [java.lang.String] 2015-01-02 16:51:20,256 WARN [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] (main) Exception encountered during context initialization - cancelling refresh attempt org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/web/servlet/config/annotation/DelegatingWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openEntityManagerInViewInterceptor' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration$JpaWebConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:602) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1111) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1006) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691) at org.springframework.boot.SpringApplication.run(SpringApplication.java:321) at org.springframework.boot.SpringApplication.run(SpringApplication.java:961) at springboot.Application.main(Application.java:32) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53) at java.lang.Thread.run(Unknown Source) Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping]: Factory method 'requestMappingHandlerMapping' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openEntityManagerInViewInterceptor' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration$JpaWebConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:591) ... 22 more Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openEntityManagerInViewInterceptor' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/JpaBaseConfiguration$JpaWebConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:547) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:322) at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration$JpaWebConfiguration$$EnhancerBySpringCGLIB$$a50a6fd9.openEntityManagerInViewInterceptor() at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration$JpaWebConfiguration.addInterceptors(JpaBaseConfiguration.java:168) at org.springframework.web.servlet.config.annotation.WebMvcConfigurerComposite.addInterceptors(WebMvcConfigurerComposite.java:112) at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration.addInterceptors(DelegatingWebMvcConfiguration.java:55) at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.getInterceptors(WebMvcConfigurationSupport.java:259) at org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport.requestMappingHandlerMapping(WebMvcConfigurationSupport.java:228) at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration$$EnhancerBySpringCGLIB$$7c201664.CGLIB$requestMappingHandlerMapping$24() at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration$$EnhancerBySpringCGLIB$$7c201664$$FastClassBySpringCGLIB$$c4e37a95.invoke() at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309) at org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration$$EnhancerBySpringCGLIB$$7c201664.requestMappingHandlerMapping() at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ... 23 more Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [javax.persistence.EntityManagerFactory] is defined at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:371) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331) at org.springframework.orm.jpa.EntityManagerFactoryUtils.findEntityManagerFactory(EntityManagerFactoryUtils.java:143) at org.springframework.orm.jpa.EntityManagerFactoryAccessor.setBeanFactory(EntityManagerFactoryAccessor.java:137) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1585) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1553) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539) ... 45 more
您可以使用@EnableAutoConfiguration
的exclude
属性禁用特定部分。在你的情况下,你可能想要:
@EnableAutoConfiguration(exclude=HibernateJpaAutoConfiguration.class)
我在下面定义的
问题内容: 直到最近,当一个人正在处理一堆容器并且其中一个启动的容器停止时,所有容器都停止了。自从https://github.com/docker/compose/issues/741以来,情况就不再如此了,这对我们来说真的很烦人:我们使用docker- compose运行selenium测试,这意味着启动应用程序服务器,启动selenium hub +节点,启动测试驱动程序,然后在测试驱动程序
问题内容: 我有一个问题,提交表单时所有活动的ajax请求均失败,并触发错误事件。 如何在不触发错误事件的情况下停止jQuery中所有活动的ajax请求? 问题答案: 每次创建ajax请求时,都可以使用变量来存储它: 然后,您可以中止请求: 您可以使用数组来跟踪所有未决的ajax请求,并在必要时中止它们。
问题内容: 我正在使用我的应用程序拨打电话。 一段时间后有什么办法可以终止通话?还是在ACTION_CALL开始之前设置一个计时器? 我正在使用Prasanta博客中的以下代码,但由于某些原因,导致出现以下错误。有什么建议? 无法解决 问题答案: 您的问题已被问过很多次了。简短的答案是,没有官方的方法可以做到这一点。 在一个问题中,有人建议打开飞行模式(应用程序当然需要权限才能执行此操作)。这很粗
我无法停止。它的样式是。如何启动和停止圆形的小型?
我创建了一个全新的项目来展示我的问题。基本上,我的片段有两个。在使用CreateView时,我总是使用。但是,如果我检查,然后通过按后退按钮向外导航,下次打开它时,它会自动检查。那种行为打破了我的逻辑。 MainActivity.java weirdfragment.java 因此,我可以看到它是onRestoreInstanceState检查我的。但我不知道如何预防。我正在考虑的事情: 在OnV