Bean could not be found in Spring Boot Lombok Controller

28 Views Asked by At

I get the following exception:

Parameter 1 of constructor in RController required a bean of type 'UmaEvaluator' that could not be found.
Action:
Consider defining a bean of type 'UmaEvaluator' in your configuration.

If you need any more details, please let me know. Thank you in advance.

And here the class definitions:

@Component
@RequiredArgsConstructor
@ConditionalOnBean(SecurityConfig.class)
public class UmaEvaluator implements PermissionEvaluator {

}

@Configuration
public class SecurityConfig {

    @Bean
    static MethodSecurityExpressionHandler methodSecurityExpressionHandler(
        UmaEvaluator umaEvaluator) {
    DefaultMethodSecurityExpressionHandler expressionHandler = new DefaultMethodSecurityExpressionHandler();
    expressionHandler.setPermissionEvaluator(umaEvaluator);
    return expressionHandler;

}

@RequiredArgsConstructor
@RestController
public class RController {

    private final RService rService;

    private final UmaEvaluator umaEvaluator;
}
0

There are 0 best solutions below