错误信息:
2014-01-09 21:17:54 Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.hailong.midea.busi.user.manager.UserManager com.hailong.midea.web.user.UserController.userManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.hailong.midea.busi.user.manager.UserManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:242)
at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:492)
at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:312)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:776)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:258)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1213)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:256)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:167)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:224)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:90)
at org.eclipse.jetty.server.Server.doStart(Server.java:263)
at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511)
at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364)
at org.mortbay.jetty.plugin.JettyRunMojo.execute(JettyRunMojo.java:514)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:540)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:519)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.hailong.midea.busi.user.manager.UserManager com.hailong.midea.web.user.UserController.userManager; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.hailong.midea.busi.user.manager.UserManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:502)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:282)
... 56 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.hailong.midea.busi.user.manager.UserManager] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:920)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:789)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:703)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:474)
... 58 more
解决方案:
从错误上看是因为UserController 中的userManager注入失败导致Spring容器初始化失败。
为什么注入失败,肯定是spring的配置文件中的配置项导致。
打开spring的xml配置文件看到context:component-scan 自动扫描组件的配置 ,只配置了扫描com.hailong.midea.web.user包下的controller,
而没有配置扫描busi层,导致注入失败,如果busi层和controller层的包名前一部分相同,则配置两者相同部分即可。配置如下:
配置方法一:
<context:component-scan base-package="com.xxxx.midea"/>
或者是配置两组不同的部分也是可行的。
配置方法二:
<!-- spring组件扫描器;如扫描(Controller、Service等等) -->
<context:component-scan base-package="com.xxxx.midea.busi.user.manager" />
<context:component-scan base-package="com.xxxx.midea.web.user" />
相关推荐
1. **检查仓库配置**:首先确认`settings.xml`中的仓库配置是否正确,包括阿里云仓库的URL。如果仓库URL没有问题,那么可能是该仓库没有存储这个特定的依赖版本。 2. **寻找替代源**:如果官方仓库或默认镜像无法...
当我们从github上下载了blockly之后,打卡demos下的index.html时,选择blockly-developer-tools时会弹出一个对话框(大体内容是closure dependency not found),此时我们需要下载这个文件,解压并且命名为closure-...
标题中的“sqlite3:not found”是一个常见的错误提示,通常在Linux或类Unix系统中出现,意味着系统找不到sqlite3命令行工具。SQLite是一款轻量级的数据库管理系统,它被广泛应用于嵌入式设备、移动应用以及服务器端...
在使用Linux或Unix类操作系统时,可能会遇到"sqlite3 not found"这样的错误提示,这通常意味着系统中没有安装SQLite3这个数据库引擎或者其路径没有被正确地添加到系统的PATH环境变量中。SQLite3是一个轻量级、开源的...
本文将深入探讨关于"junit-4.12.rar"包及其依赖包,以及如何解决在使用JUnit 4进行单元测试时遇到的"method initializationerror not found"错误。 首先,我们来了解JUnit 4.12版本。这是JUnit的一个稳定版本,发布...
(第一次写文章,我经验也不足,根据自己的理解来向大家解释一下) 先说一说今天被折磨一整天的感悟: 当项目导入、运行爆红时,一个劲百度出现的错误和解决方案,可能不是最先做的事。 加深对于项目运行过程的理解...
vue3 + express的项目中报错:warning in ./node_modules/express/lib/view.js, Critical dependency: the request of a dependency is an expression 的解决方案。 必能解决。
还有`@Ignore`注解可以临时忽略某个测试,`@Expected`用于指定预期的异常等。 其次,Junit4.12提供了断言(Assertion)机制,用于检查代码的运行结果是否符合预期。例如,`assertEquals()`用于比较两个值是否相等,...
1.检查镜像,这里我换成了阿里云的下载源,看不出来有什么毛病 2.检查IDEA中maven的仓库配置,我用是自定义的仓库,仓库已经在settings.xml中配置过,下图为下载的apache-maven-3.6.3中的settings.xml配置 下载的...
<dependency> <groupId>com.itextpdf</groupId> <artifactId>itext7-core <version>7.1.0 <type>pom </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>html2pdf</artifactId> ...
因此,当Maven尝试构建项目并找不到ojdbc6时,会抛出“not found”错误。 解决这个问题有几种方法: 1. **本地添加**:你可以将ojdbc6.jar文件手动添加到你的本地Maven仓库。通常,这个仓库位于用户的主目录下的`....
在Vue项目开发中,我们有时会遇到一个常见的错误提示:“This dependency was not found”,这通常是由于模块导入路径不正确或Webpack配置不完善导致的。在本文中,我们将深入探讨这个问题,分析其原因,并提供解决...
4. "groboutils-core-5.jar.sha1":另一个校验文件,提供的是SHA1校验和,与MD5类似,用于验证文件的完整性。 总的来说,Groboutils-core-5是Groboutils项目的核心库,提供了丰富的功能,且经过了实际测试。通过JAR...
linux系统,rpm资源glibc-headers-2.12-1.212.el6_10.3.x86_64.rpm,适用于centos6.9,没有在centos7上进行测试。
"Vue中"This dependency was not found"问题的解决方法" Vue 中的"This dependency was not found"问题是指在使用 Vue 框架进行开发时,无法找到依赖项的情况。这类问题常见于编译时,控制台会报错,表示无法找到...
StorageClient1 storageClient1 = new StorageClient1(trackerServer, storageServer); String fileId = storageClient1.uploadFile("path/to/your/file", "fileExt"); ``` - 下载文件: ```java StorageServer ...
<dependency> <groupId>com.kingbase</groupId> <artifactId>kingbase8 <version>8.2.0 </dependency> <dependency> <groupId>com.kingbase</groupId> <artifactId>kingbase8 <version>8.6.0 </...
hive 开发UDF 使用maven工程 引发jar包缺失 hive 开发UDF 使用maven工程 引发jar包缺失
Gradle dependency: compile 'homhomlin.lib:psv-library:1.0.1' or Maven dependency: homhomlin.lib psv-library 1.0.1 API v12 : Gradle dependency: compile 'homhomlin.lib.v12:psv-library:1.0.1' or ...