failing to Autowire the AuthenticationContext class

public class SecurityService {

private final AuthenticationContext authenticationContext;

public SecurityService(AuthenticationContext authenticationContext) {
    this.authenticationContext = authenticationContext;

public UserDetails getAuthenticatedUser() {
    return authenticationContext.getAuthenticatedUser(UserDetails.class).get();

public void logout() {


Am getting the error Parameter 0 of constructor in required a bean of type ‘’ that could not be found.

The bean is created by the Vaadin security configuration, what’s your security configuration?

public class SecurityConfig extends VaadinWebSecurity {
    protected void configure(HttpSecurity http) throws Exception {
        setLoginView(http, LoginView.class);
    public UserDetailsService users() {
        UserDetails user = User.builder()
        UserDetails admin = User.builder()
        return new InMemoryUserDetailsManager(user, admin);


With the annotations ?
@EnableWebSecurity @Configuration

(Is it a new project or did you change something in your project?)

Yes The class has those , i ommited them in the code

Am following the tutorial on

I think the SecurityConfig is ignored. Maybe the SecurityConfig is not in the same package or in a subpackage of the

Sorry I think am half awake, I didn’t include the annotations @EnableWebSecurity
@Configuration on the SecurityConfig class. Error gone after putting them . Thanks a lot