java-spring添加@Async后报错.BeanCurrentlyInCreationException

问题描述

spring添加@Async后报错.BeanCurrentlyInCreationException

今天想优化一个action,所以在一个方法上添加了@Async的注解,
可是在启动程序时候却报了这个错,求指点。
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'cacheService': Bean with name 'cacheService' has been injected into other beans【】in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:568)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:797)
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:530)
at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:770)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:342)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1368)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.startWebapp(JettyWebAppContext.java:320)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1335)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:734)
at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:259)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:511)
at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:403)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:405)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:106)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:372)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:457)
at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:328)
at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute(JettyRunMojo.java:170)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

解决方案

Spring @Async

解决方案二:

http://www.oschina.net/question/1435284_143151

时间: 2024-08-31 06:16:03

java-spring添加@Async后报错.BeanCurrentlyInCreationException的相关文章

struts2 spring hibernate整合后报错

问题描述 struts2 spring hibernate整合后报错 在eclipse里面run on server之后,可以正确显示界面,但当填写表单点击按钮后出现了这个报错 Struts Problem Report Struts has detected an unhandled exception: Messages: 1.org.hibernate.SessionFactory.openSession()Lorg/hibernate/classic/Session; 2.Method

java spring 面试题 找错

问题描述 java spring 面试题 找错 大神们帮忙,去了滴答拼车给的面试题,小弟我愣是没看懂,求解惑. 如下代码用spring管理,请说出代码是否有问题,如果有错请指出并修改. classTestDao(){ public void doUpdate(){ try{ update table1;//一个更新操作,无需关注语法 update table2;//一个更新操作,无需关注语法 insert history;//一个插入操作,无需关注语法 }catch(Exception e){

mysql服务器重新添加内存条后报错

问题描述 mysql服务器重新添加内存条后报错 mysql服务器安装新的内存条后报错 Notification Type: PROBLEM Service: memory Host: mysql server Address:*********** State: CRITICAL Date/Time: Mon Jan 26 18:32:02 CST 2015 Additional Info: (Return code of 255 is out of bounds) 这是怎么回事?? 解决方案

spring mvc-service层加入@Tractional 后报错error creating bean

问题描述 service层加入@Tractional 后报错error creating bean 我在一个web项目中想加入事务,是采用spring mvc+hibernate的框架配置文件中已经加入 <!-- 配置Hibernate事务管理器 --> <bean id=""transactionManager"" class=""org.springframework.orm.hibernate4.HibernateTran

ssh做的一个web项目,添加xfire的webservice支持后报错,小弟急求

问题描述 由于我们提供的接口有点多,我就想在原来的工程上添加xfire的webservice支持,谁知道,添加了报错,看了不少帖子说是spring的jar包和spring-.1.2.6.jar冲突,然后把后面的jar包删除,不包那个错,[dtss]2015-01-1517:35:39,346ERROR[main]org.springframework.ws.transport.http.MessageDispatcherServlet.initServletBean-290|Contextini

spring springmvc mybatis 加入shiro后报错

问题描述 spring springmvc mybatis 加入shiro后报错 2016-3-23 15:14:53 org.apache.catalina.core.StandardContext listenerStart 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org

java+Spring+mybatis 查询sql报错:无效的序列号!

问题描述 java+Spring+mybatis 查询sql报错:无效的序列号! java+Spring+mybatis+lucens+达梦数据库.应该能判断和数据库和lucen没关系.,着急在线等!mybatis: SELECT COUNT(*) FROM ""user_task"" title"" like '%""#{title}""%' And ""status"&qu

java启动tomcat,在浏览器输入输入地之后报错

问题描述 java启动tomcat,在浏览器输入输入地之后报错 今天启动Tomcat之后,在地址栏中输入对应的地址,报错如下 严重: Invalid message recieved with signature 18245 求大神怎么解决 解决方案 试着改一下tomcat的端口 解决方案二: http://zhycaf.iteye.com/blog/977615 tomcat目录下的server.xml. 尝试改一下Connector 的port 端口值

图片-SSRS 添加用户登录后报错

问题描述 SSRS 添加用户登录后报错 解决方案 https://technet.microsoft.com/zh-cn/bb630430.aspx 遇到同样问题的可以按照此站点的配置进行设置就好了