Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationManager' in your configuration.

简介: Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationManager' in your configuration.

Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationManager' in your configuration.

[2023-04-25 14:44:36.426] [main] [ERROR] o.s.b.diagnostics.LoggingFailureAnalysisReporter - 
***************************
APPLICATION FAILED TO START
***************************
Description:
Field authenticationManager in com.vipsoft.web.security.AuthorizationService required a bean of type 'org.springframework.security.authentication.AuthenticationManager' that could not be found.
The injection point has the following annotations:
  - @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationManager' in your configuration.
Disconnected from the target VM, address: '127.0.0.1:10059', transport: 'socket'
Process finished with exit code 1

authenticationManagerBean 加上 @Bean

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
    /**
     * 解决 无法直接注入 AuthenticationManager
     *
     * @return
     * @throws Exception
     */
    @Bean
    @Override
    public AuthenticationManager authenticationManagerBean() throws Exception
    {
        return super.authenticationManagerBean();
    }
}
目录
相关文章
|
4月前
|
Java
SpringBoot注入出现@org.springframework.beans.factory.annotation.Autowired(required=true)
SpringBoot注入出现@org.springframework.beans.factory.annotation.Autowired(required=true)
60 0
|
4月前
SpringCloud启动Consider defining a bean of type ‘org.springframework.web.client.RestTemplate‘ in your
SpringCloud启动Consider defining a bean of type ‘org.springframework.web.client.RestTemplate‘ in your
89 1
|
11月前
|
Java 微服务 Spring
【Java异常】Spring boot启动失败@org.springframework.beans.factory.annotation.Autowired(required=true)
【Java异常】Spring boot启动失败@org.springframework.beans.factory.annotation.Autowired(required=true)
109 0
|
4月前
解决The injection point has the following annotations:@org.springframework.beans.factory.annotation错误~
解决The injection point has the following annotations:@org.springframework.beans.factory.annotation错误~
714 0
No qualifying bean of type ‘org.springframework.boot.autoconfigure.http.HttpMessageConverters‘ avail
No qualifying bean of type ‘org.springframework.boot.autoconfigure.http.HttpMessageConverters‘ avail
139 1
|
Java Spring
required a bean of type ‘org.springframework.web.client.RestTemplate‘ that could not be found.
required a bean of type ‘org.springframework.web.client.RestTemplate‘ that could not be found.
required a bean of type ‘org.springframework.web.client.RestTemplate‘ that could not be found.
|
前端开发 Java 应用服务中间件
Error configuring application listener of class org.springframework.web.context.ContextLoader
Error configuring application listener of class org.springframework.web.context.ContextLoader
Error configuring application listener of class org.springframework.web.context.ContextLoader
|
Java 应用服务中间件 Maven
Error configuring application listener of class org.springframework.web.context.ContextLoaderListene
Error configuring application listener of class org.springframework.web.context.ContextLoaderListene
104 0
|
Java 数据库连接 Spring
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘ XXX‘
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘ XXX‘
164 0
|
缓存 Java Maven
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderLis
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderLis
126 0
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderLis