Problem with bean creation when I add security config in client yaml
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'helloController': Unsatisfied dependency expressed through field 'webClient'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webClient' defined in class path resource
I am also facing the same issue.
did you guys figure out the error?? i got the same error too !!
I also got the same error creating bean Securityfilterchain unsatisfiedDependencyException
spring security version 6 depricated some of the methods, therefor you have to change 'WebSecurityConfig' syntax like this -
@EnableWebSecurity @Configuration public class WebSecurityConfig {
@Bean
public PasswordEncoder passwordEncoder(){
return new BCryptPasswordEncoder(11);
}
private static final String[] WHIT_LIST_URLS = {
"/hello",
"/register",
"/verifyRegistration*",
"/resendVerificationToken*",
"/changePassword*"
};
@Bean
SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
.csrf(csrf->csrf.disable())
.cors(cors->cors.disable())
.authorizeHttpRequests((authz)-> authz
.requestMatchers(WHIT_LIST_URLS).permitAll()
.anyRequest().authenticated()
);
return http.build();
}
}
.requestMatchers(WHIT_LIST_URLS).permitAll()
@Rahu09 I got Cannot resolve method 'requestMatchers(String[])' error in WHIT_LIST_URLS
hey @Rahu09 I think you got that problem due to the naming convention of the String
`
private static final String[] WHITE_LIST_URLS = {
"/","/login","/hello","/register",
"/verifyRegistration*","/resendVerifyToken*",
"/resetPassword*","/savePassword*","/changePassword*",};
@Bean
public PasswordEncoder passwordEncoder(){
return new BCryptPasswordEncoder(11);
}
@Bean
SecurityFilterChain securityFilterChain(HttpSecurity http, HttpSecurity httpSecurity) throws Exception {
http
.csrf(AbstractHttpConfigurer::disable)
.cors(AbstractHttpConfigurer::disable)
.authorizeHttpRequests((auth)-> auth
.requestMatchers(WHITE_LIST_URLS).permitAll()
.anyRequest().authenticated()
);
return http.build();
}
`