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();
    }
}
目录
相关文章
|
6月前
|
Java
SpringBoot注入出现@org.springframework.beans.factory.annotation.Autowired(required=true)
SpringBoot注入出现@org.springframework.beans.factory.annotation.Autowired(required=true)
84 0
|
Java 微服务 Spring
【Java异常】Spring boot启动失败@org.springframework.beans.factory.annotation.Autowired(required=true)
【Java异常】Spring boot启动失败@org.springframework.beans.factory.annotation.Autowired(required=true)
222 0
|
6月前
解决The injection point has the following annotations:@org.springframework.beans.factory.annotation错误~
解决The injection point has the following annotations:@org.springframework.beans.factory.annotation错误~
1016 0
|
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.
No qualifying bean of type ‘org.springframework.boot.autoconfigure.http.HttpMessageConverters‘ avail
No qualifying bean of type ‘org.springframework.boot.autoconfigure.http.HttpMessageConverters‘ avail
158 1
|
前端开发 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
109 0
|
Java 数据库连接 mybatis
org.apache.ibatis.binding.BindingException: Type interface is not know to the MapperRegistry.
错误原因 没有将映射文件引入到MyBatis的核心文件中。 将映射文件引入即可。
163 0
org.apache.ibatis.binding.BindingException: Type interface is not know to the MapperRegistry.
|
缓存 Java Maven
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderLis
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderLis
132 0
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderLis
|
Java Maven
严重: Error configuring application listener of class org.springframework.web.util.Log4jConfigListener
严重: Error configuring application listener of class org.springframework.web.util.Log4jConfigListener
146 0
严重: Error configuring application listener of class org.springframework.web.util.Log4jConfigListener