【发布时间】:2017-04-10 05:17:16
【问题描述】:
我将我的 Spring Boot 项目作为单个 Maven 项目进行了测试,并且一切正常。 我决定将我的应用程序拆分为子模块。存储库、服务和 Spring Boot Web 模块。自动接线停止工作。 并出现以下错误:
20:12:08.052 [main] WARN o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userRestController': Unsatisfied dependency expressed through field 'userService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.plendo.service.interfaces.UserService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
20:12:08.068 [main] WARN o.s.boot.SpringApplication - Error handling failed (Error creating bean with name 'delegatingApplicationListener' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration': Initialization of bean failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry' available)
20:12:08.243 [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter - ``
***************************
APPLICATION FAILED TO START
***************************
Description:
Field userService in org.plendo.ui.controller.UserRestController required a bean of type 'org.plendo.service.interfaces.UserService' that could not be found.
【问题讨论】:
-
信息不够。你有没有例如改变你的包结构?你的项目结构和配置类现在是什么样子的?
标签: spring rest maven spring-mvc spring-boot