StackOverflowError im Frühjahr oauth2 mit benutzerdefiniertem ClientDetailsService
Ich habe meine eigene Implementierung von ClientDetailsService erstellt:
@Service
public class JpaClientDetailsService implements ClientDetailsService {
@Autowired
private ClientRepository clientRepositoy;
@Override
public ClientDetails loadClientByClientId(String clientId) throws ClientRegistrationException {
ClientDetails client = clientRepositoy.findOne(clientId);
if (client == null) {
throw new ClientRegistrationException(String.format("Client with id %s not found", clientId));
}
return client;
}
}
ClientRepository ist ein Standard-JpaRepository.
Ich habe einen AuthorizationServerConfigurerAdapter folgendermaßen konfiguriert:
@Configuration
@EnableAuthorizationServer
@EnableResourceServer
public class OAuth2ServerConfig extends AuthorizationServerConfigurerAdapter {
@Autowired
private AuthenticationManager authenticationManager;
@Autowired
private ClientDetailsService clientDetailsService;
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.authenticationManager(authenticationManager);
}
@Override
public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
clients.withClientDetails(clientDetailsService);
}
}
Aber wenn ich zu @ gehttp://localhost:9999/oauth/authorize?response_type=code&client_id=lipton
, Ich bekomme ei
java.lang.StackOverflowError: null. Spring loops on com.sun.proxy.$Proxy81.loadClientByClientId(Unknown Source).
Ich verstehe nicht warum.