my config: < /p>
Код: Выделить всё
@Bean
@Primary
public AuthenticationManager authenticationManager(HttpSecurity http) throws Exception {
return http.getSharedObject(AuthenticationManagerBuilder.class)
.authenticationProvider(daoAuthenticationProvider())
.authenticationProvider(emailAuthenticationProvider())
.authenticationProvider(oAuthClientAuthenticationProvider())
.authenticationProvider(rememberMeAuthenticationProvider())
.authenticationProvider(oneTimeTokenAuthenticationProvider())
.authenticationProvider(refreshAuthenticationProvider())
.authenticationProvider(apikeyAuthenticationProvider())
.parentAuthenticationManager(null)
.build();
}
< /code>
, когда я работаю, < /p>
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'authenticationManager': Could not resolve matching constructor on bean class [org.springframework.security.authentication.AuthenticationManager] (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities. You should also check the consistency of arguments when mixing indexed and named arguments, especially in case of bean definition inheritance)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:291)
< /code>
Я прочитал официальную документацию и внес некоторые изменения: < /p>
@Configuration
@ImportRuntimeHints(ApiRuntimeHintsConfig.class)
public class ApiRuntimeHintsConfig implements RuntimeHintsRegistrar {
@Override
public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
//反射
hints.reflection().registerType(ProviderManager.class,typeHint -> typeHint.withConstructor(TypeReference.listOf(AuthenticationProvider.class), ExecutableMode.INVOKE ));
//资源
hints.resources().registerPattern("config/application.yaml");
}
}
Затем я снова прочитал документацию о пружине, но не нашел никакой полезной конфигурации пружины
Подробнее здесь: https://stackoverflow.com/questions/792 ... ngframewor