Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcess

搭建springmvc,初始化spring时的错误

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.context.annotation.internalAsyncAnnotationProcessor’ defined in org.springframework.scheduling.annotation.ProxyAsyncConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method ‘asyncAdvisor’ threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected

错误日志

9-Oct-2017 19:11:58.135 INFO [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.servlet.DispatcherServlet.initServletBean FrameworkServlet 'mvc': initialization started
19-Oct-2017 19:11:58.138 INFO [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.context.support.XmlWebApplicationContext.prepareRefresh Refreshing WebApplicationContext for namespace 'mvc-servlet': startup date [Thu Oct 19 19:11:58 CST 2017]; parent: Root WebApplicationContext
19-Oct-2017 19:11:58.139 INFO [RMI TCP Connection(3)-127.0.0.1] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions Loading XML bean definitions from class path resource [spring-mvc.xml]
19-Oct-2017 19:12:03.891 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory C:\apache-tomcat-8.0.37\webapps\manager
19-Oct-2017 19:12:04.014 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory C:\apache-tomcat-8.0.37\webapps\manager has finished in 103 ms
19-Oct-2017 19:12:05.347 INFO [RMI TCP Connection(3)-127.0.0.1] org.springframework.beans.factory.support.DefaultListableBeanFactory.registerBeanDefinition Overriding bean definition for bean 'jCacheOperationSource' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=proxyJCacheConfiguration; factoryMethodName=cacheOperationSource; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.cache.jcache.config.ProxyJCacheConfiguration] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=abstractJCacheConfiguration; factoryMethodName=cacheOperationSource; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.cache.jcache.config.AbstractJCacheConfiguration]
19-Oct-2017 19:12:05.354 INFO [RMI TCP Connection(3)-127.0.0.1] org.springframework.beans.factory.support.DefaultListableBeanFactory.registerBeanDefinition Overriding bean definition for bean 'mvcContentNegotiationManager' with a different definition: replacing [Root bean: class [org.springframework.web.accept.ContentNegotiationManagerFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=delegatingWebMvcConfiguration; factoryMethodName=mvcContentNegotiationManager; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration]
19-Oct-2017 19:12:05.355 INFO [RMI TCP Connection(3)-127.0.0.1] org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.isOverriddenByExistingDefinition Skipping bean definition for [BeanMethod:name=mvcUriComponentsContributor,declaringClass=org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport]: a definition for bean 'mvcUriComponentsContributor' already exists. This top-level bean definition is considered as an override.
19-Oct-2017 19:12:05.355 INFO [RMI TCP Connection(3)-127.0.0.1] org.springframework.beans.factory.support.DefaultListableBeanFactory.registerBeanDefinition Overriding bean definition for bean 'mvcHandlerMappingIntrospector' with a different definition: replacing [Root bean: class [org.springframework.web.servlet.handler.HandlerMappingIntrospector]; scope=; abstract=false; lazyInit=true; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Root bean: class [null]; scope=; abstract=false; lazyInit=true; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=delegatingWebMvcConfiguration; factoryMethodName=mvcHandlerMappingIntrospector; initMethodName=null; destroyMethodName=(inferred); defined in org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration]
19-Oct-2017 19:12:05.668 WARNING [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.context.support.XmlWebApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' defined in org.springframework.scheduling.annotation.ProxyAsyncConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method 'asyncAdvisor' threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
19-Oct-2017 19:12:05.669 SEVERE [RMI TCP Connection(3)-127.0.0.1] org.springframework.web.servlet.DispatcherServlet.initServletBean Context initialization failed
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.internalAsyncAnnotationProcessor' defined in org.springframework.scheduling.annotation.ProxyAsyncConfiguration: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method 'asyncAdvisor' threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)

springmvc配置文件代码

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:p="http://www.springframework.org/schema/p"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
    ">

    <mvc:annotation-driven/>
    <context:component-scan base-package="*"/>
</beans>

问题就在这

<context:component-scan base-package="*"/>

* 扫描的是所有包,改成项目对应的包

例如

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:p="http://www.springframework.org/schema/p"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
    ">

    <mvc:annotation-driven/>
    <context:component-scan base-package="cn.itcast.scm.*"/>
</beans>

第一次发,希望能帮助大家,也鼓励自己每次遇到问题都把解决办法记录下来

  • 7
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
META-INF/MANIFEST.MF META-INF/license.txt org.springframework.remoting.caucho.BurlapClientInterceptor.class org.springframework.remoting.caucho.BurlapProxyFactoryBean.class org.springframework.remoting.caucho.BurlapServiceExporter.class org.springframework.remoting.caucho.Hessian1SkeletonInvoker.class org.springframework.remoting.caucho.Hessian2SkeletonInvoker.class org.springframework.remoting.caucho.HessianClientInterceptor.class org.springframework.remoting.caucho.HessianProxyFactoryBean.class org.springframework.remoting.caucho.HessianServiceExporter.class org.springframework.remoting.caucho.HessianSkeletonInvoker.class org.springframework.remoting.httpinvoker.AbstractHttpInvokerRequestExecutor.class org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor.class org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration.class org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.class org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean.class org.springframework.remoting.httpinvoker.HttpInvokerRequestExecutor.class org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter.class org.springframework.remoting.httpinvoker.SimpleHttpInvokerRequestExecutor.class org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor.class org.springframework.remoting.jaxrpc.JaxRpcPortProxyFactoryBean.class org.springframework.remoting.jaxrpc.JaxRpcServicePostProcessor.class org.springframework.remoting.jaxrpc.JaxRpcSoapFaultException.class org.springframework.remoting.jaxrpc.LocalJaxRpcServiceFactory.class org.springframework.remoting.jaxrpc.LocalJaxRpcServiceFactoryBean.class org.springframework.remoting.jaxrpc.ServletEndpointSupport.class org.springframework.remoting.jaxrpc.support.AxisBeanMappingServicePostProcessor.class org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.class org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean.class org.springframework.remoting.jaxws.JaxWsSoapFaultException.class org.springframework.remoting.jaxws.LocalJaxWsServiceFactory.class org.springframework.remoting.jaxws.LocalJaxWsServiceFactoryBean.class org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter.class org.springframework.web.HttpRequestHandler.class org.springframework.web.HttpRequestMethodNotSupportedException.class org.springframework.web.HttpSessionRequiredException.class org.springframework.web.bind.EscapedErrors.class org.springframework.web.bind.MissingServletRequestParameterException.class org.springframework.web.bind.RequestUtils.class org.springframework.web.bind.ServletRequestBindingException.class org.springframework.web.bind.ServletRequestDataBinder.class org.springframework.web.bind.ServletRequestParameterPropertyValues.class org.springframework.web.bind.ServletRequestUtils.class org.springframework.web.bind.WebDataBinder.class org.springframework.web.bind.annotation.InitBinder.class org.springframework.web.bind.annotation.ModelAttribute.class org.springframework.web.bind.annotation.RequestMapping.class org.springframework.web.bind.annotation.RequestMethod.class org.springframework.web.bind.annotation.RequestParam.class org.springframework.web.bind.annotation.SessionAttributes.class org.springframework.web.bind.support.ConfigurableWebBindingInitializer.class org.springframework.web.bind.support.DefaultSessionAttributeStore.class org.springframework.web.bind.support.SessionAttributeStore.class org.springframework.web.bind.support.SessionStatus.class org.springframework.web.bind.support.SimpleSessionStatus.class org.springframework.web.bind.support.WebBindingInitializer.class org.springframework.web.context.ConfigurableWebApplicationContext.class org.springframework.web.context.ContextLoader.class org.springframework.web.context.ContextLoaderListener.class org.springframework.web.context.ContextLoaderServlet.class org.springframework.web.context.ServletConfigAware.class org.springframework.web.context.ServletContextAware.class org.springframework.web.context.WebApplicationContext.class org.springframework.web.context.request.AbstractRequestAttributes.class org.springframework.web.context.request.AbstractRequestAttributesScope.class org.springframework.web.context.request.Log4jNestedDiagnosticContextInterceptor.class org.springframework.web.context.request.RequestAttributes.class org.springframework.web.context.request.RequestContextHolder.class org.springframework.web.context.request.RequestContextListener.class org.springframework.web.context.request.RequestScope.class org.springframework.web.context.request.ServletRequestAttributes.class org.springframework.web.context.request.ServletWebRequest.class org.springframework.web.context.request.SessionScope.class org.springframework.web.context.request.WebRequest.class org.springframework.web.context.request.WebRequestInterceptor.class org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.class org.springframework.web.context.support.ContextExposingHttpServletRequest.class org.springframework.web.context.support.GenericWebApplicationContext.class org.springframework.web.context.support.HttpRequestHandlerServlet.class org.springframework.web.context.support.PerformanceMonitorListener.class org.springframework.web.context.support.RequestHandledEvent.class org.springframework.web.context.support.ServletContextAttributeExporter.class org.springframework.web.context.support.ServletContextAttributeFactoryBean.class org.springframework.web.context.support.ServletContextAwareProcessor.class org.springframework.web.context.support.ServletContextFactoryBean.class org.springframework.web.context.support.ServletContextParameterFactoryBean.class org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer.class org.springframework.web.context.support.ServletContextResource.class org.springframework.web.context.support.ServletContextResourceLoader.class org.springframework.web.context.support.ServletContextResourcePatternResolver.class org.springframework.web.context.support.ServletRequestHandledEvent.class org.springframework.web.context.support.StaticWebApplicationContext.class org.springframework.web.context.support.WebApplicationContextUtils.class org.springframework.web.context.support.WebApplicationObjectSupport.class org.springframework.web.context.support.XmlWebApplicationContext.class org.springframework.web.filter.AbstractRequestLoggingFilter.class org.springframework.web.filter.CharacterEncodingFilter.class org.springframework.web.filter.CommonsRequestLoggingFilter.class org.springframework.web.filter.DelegatingFilterProxy.class org.springframework.web.filter.GenericFilterBean.class org.springframework.web.filter.Log4jNestedDiagnosticContextFilter.class org.springframework.web.filter.OncePerRequestFilter.class org.springframework.web.filter.RequestContextFilter.class org.springframework.web.filter.ServletContextRequestLoggingFilter.class org.springframework.web.jsf.DecoratingNavigationHandler.class org.springframework.web.jsf.DelegatingNavigationHandlerProxy.class org.springframework.web.jsf.DelegatingPhaseListenerMulticaster.class org.springframework.web.jsf.DelegatingVariableResolver.class org.springframework.web.jsf.FacesContextUtils.class org.springframework.web.jsf.SpringBeanVariableResolver.class org.springframework.web.jsf.WebApplicationContextVariableResolver.class org.springframework.web.jsf.el.SpringBeanFacesELResolver.class org.springframework.web.jsf.el.WebApplicationContextFacesELResolver.class org.springframework.web.multipart.MaxUploadSizeExceededException.class org.springframework.web.multipart.MultipartException.class org.springframework.web.multipart.MultipartFile.class org.springframework.web.multipart.MultipartHttpServletRequest.class org.springframework.web.multipart.MultipartResolver.class org.springframework.web.multipart.commons.CommonsFileUploadSupport.class org.springframework.web.multipart.commons.CommonsMultipartFile.class org.springframework.web.multipart.commons.CommonsMultipartResolver.class org.springframework.web.multipart.support.AbstractMultipartHttpServletRequest.class org.springframework.web.multipart.support.ByteArrayMultipartFileEditor.class org.springframework.web.multipart.support.DefaultMultipartHttpServletRequest.class org.springframework.web.multipart.support.MultipartFilter.class org.springframework.web.multipart.support.StringMultipartFileEditor.class org.springframework.web.util.CookieGenerator.class org.springframework.web.util.ExpressionEvaluationUtils.class org.springframework.web.util.HtmlCharacterEntityDecoder.class org.springframework.web.util.HtmlCharacterEntityReferences.class org.springframework.web.util.HtmlUtils.class org.springframework.web.util.HttpSessionMutexListener.class org.springframework.web.util.IntrospectorCleanupListener.class org.springframework.web.util.JavaScriptUtils.class org.springframework.web.util.Log4jConfigListener.class org.springframework.web.util.Log4jConfigServlet.class org.springframework.web.util.Log4jWebConfigurer.class org.springframework.web.util.NestedServletException.class org.springframework.web.util.TagUtils.class org.springframework.web.util.UrlPathHelper.class org.springframework.web.util.WebAppRootListener.class org.springframework.web.util.WebUtils.class org/springframework/web/context/ContextLoader.properties org/springframework/web/util/HtmlCharacterEntityReferences.properties

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值