Requested in question bean is currently creation of mind when a service starts when injected bean

Found a muc test server failed to start, the other is good, no problem locally, the error message is as follows:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mucAccountLoginController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration': Unsatisfied dependency expressed through field 'configurers'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pcAuthorizationServerConfig': Unsatisfied dependency expressed through field 'authenticationManager'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webSecurityConfig': Unsatisfied dependency expressed through field 'formAuthenticationConfig'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'formAuthenticationConfig' defined in URL [jar:file:/home/rockysaas/muc/rockysaas-provider-muc.jar!/BOOT-INF/lib/rockysaas-security-core-1.0.jar!/com/rockysaas/security/core/authentication/FormAuthenticationConfig.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pcAuthenticationSuccessHandler': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'defaultAuthorizationServerTokenServices': Requested bean is currently in creation: Is there an unresolvable circular reference?

The reason is that originally there

public class PcAuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler {

    @Resource
    private ObjectMapper objectMapper;

    @Resource
    private ClientDetailsService clientDetailsService;

    @Autowired
    private PasswordEncoder passwordEncoder;

    @Resource
    private MucAccountService mucAccountService;

    @Resource
    private MucPlatformMapper mucPlatformMapper;

    @Resource
    private AuthorizationServerTokenServices authorizationServerTokenServices;

Later mucAccountLoginController added a segment of code

 
 

@RestController

public class MucAccountLoginController extends BaseController {

    @Resource
    private MucLoginService mucLoginService;
    @Resource
    private MucAccountTokenService mucUserTokenService;
    @Resource
    private ClientDetailsService clientDetailsService;
    @Autowired
    private PasswordEncoder passwordEncoder;

    @Resource
    private MdcApplicationFeignApi mdcApplicationFeignApi;

    @Resource
    private AuthorizationServerTokenServices authorizationServerTokenServices;

Originally only a AuthorizationServerTokenServices need to inject, it has now become two, if simultaneous injection time will be given. On one of the classes to be injected like a plus @Lazy

@RestController
@RequestMapping(value = "", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(tags = "Web - 账号登录相关", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class MucAccountLoginController extends BaseController {

    @Resource
    private MucLoginService mucLoginService;
    @Resource
    private MucAccountTokenService mucUserTokenService;
    @Resource
    private ClientDetailsService clientDetailsService;
    @Autowired
    private PasswordEncoder passwordEncoder;

    @Resource
    private MdcApplicationFeignApi mdcApplicationFeignApi;

    @Resource
    @Lazy
    private AuthorizationServerTokenServices authorizationServerTokenServices;

 

Guess you like

Origin www.cnblogs.com/zjhgx/p/12158698.html