Skip to content

can not auto import bean #34784

@baozi-2019

Description

@baozi-2019

spring boot version: 3.4.4

I create a new project.
authenticationManager can not create because servcie can not find.


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v3.4.4)

2025-04-20T14:17:21.795+08:00  INFO 3408 --- [           main] o.j.web.api.JengaWebApiApplication       : Starting JengaWebApiApplication using Java 21.0.1 with PID 3408 (/Users/baoqingyang/projects/JengaFree/backend/jenga-web-api/target/classes started by baoqingyang in /Users/baoqingyang/projects/JengaFree/backend)
2025-04-20T14:17:21.797+08:00  INFO 3408 --- [           main] o.j.web.api.JengaWebApiApplication       : The following 1 profile is active: "db"
2025-04-20T14:17:22.224+08:00  WARN 3408 --- [           main] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in '[org.jengafree.web.api]' package. Please check your configuration.
2025-04-20T14:17:22.451+08:00  INFO 3408 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 8080 (http)
2025-04-20T14:17:22.462+08:00  INFO 3408 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2025-04-20T14:17:22.462+08:00  INFO 3408 --- [           main] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.39]
2025-04-20T14:17:22.493+08:00  INFO 3408 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2025-04-20T14:17:22.493+08:00  INFO 3408 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 671 ms
2025-04-20T14:17:22.530+08:00  WARN 3408 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authController' defined in file [/Users/baoqingyang/projects/JengaFree/backend/jenga-auth/jenga-auth-security-service/target/classes/com/jenjafree/auth/security/controller/AuthController.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'authServiceImpl' defined in file [/Users/baoqingyang/projects/JengaFree/backend/jenga-auth/jenga-auth-security-service/target/classes/com/jenjafree/auth/security/service/impl/AuthServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'authenticationManager' defined in class path resource [com/jenjafree/auth/security/config/SecurityConfig.class]: Unsatisfied dependency expressed through method 'authenticationManager' parameter 0: No qualifying bean of type 'org.jengafree.user.service.IUserRoleService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2025-04-20T14:17:22.532+08:00  INFO 3408 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2025-04-20T14:17:22.608+08:00  INFO 3408 --- [           main] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2025-04-20T14:17:22.624+08:00 ERROR 3408 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Parameter 0 of method authenticationManager in com.jenjafree.auth.security.config.SecurityConfig required a bean of type 'org.jengafree.user.service.IUserRoleService' that could not be found.


Action:

Consider defining a bean of type 'org.jengafree.user.service.IUserRoleService' in your configuration.'```

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions