首页 > 其他分享 >Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationMan

Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationMan

时间:2023-04-25 14:55:05浏览次数:33  
标签:Consider AuthenticationManager bean springframework authentication org security 

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();
    }
}

标签:Consider,AuthenticationManager,bean,springframework,authentication,org,security,
From: https://www.cnblogs.com/vipsoft/p/17352592.html

相关文章