StackOverflowError in spring oauth2 with custom ClientDetailsService

后端 未结 4 455
面向向阳花
面向向阳花 2021-02-04 11:02

I made my own implementation of ClientDetailsService:

@Service
public class JpaClientDetailsService implements ClientDetailsService {
    @Autowired
    private          


        
4条回答
  •  南方客
    南方客 (楼主)
    2021-02-04 11:22

    I do not understand why, but if I inject my bean directly instead of injecting the interface, it works :

    public class OAuth2ServerConfig extends AuthorizationServerConfigurerAdapter {
    ...
      @Autowired
      private JpaClientDetailsService clientDetailsService;
    ...
    

    it also works if I annotate my service with @Primary annotation:

    @Service
    @Primary
    public class JpaClientDetailsService implements ClientDetailsService {
    

提交回复
热议问题