I am just trying to do a learning exercise with Vaadin 10 and Spring boot. I added Sprint Security as well so the demo prompts for a user name and password. However when I type them correctly the browser just shows:
Could not navigate to ''
Reason: Couldn't find route for ''
Available routes:
This detailed message is only shown when running in development mode.
I rather hoped to see a button with 'click me' on it.
My MainView class is:
@Route
public class MainView extends VerticalLayout {
public MainView() {
add(new Button("Click me", e -> Notification.show("Hello Spring+Vaadin user!")));
}
}
My WebSecurityConfigurerAdapter is:
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin();
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("test").password("test").roles("USER");
}
@Bean
public static NoOpPasswordEncoder passwordEncoder() {
return (NoOpPasswordEncoder) NoOpPasswordEncoder.getInstance();
}
}
Any help greatly appreciated. Thanks very much.
Mark.
Thanks for the help I received. I have found the simple mistake I made in that I put my MainView class in a sub package (called gui). When I moved it to the same package the as the main application class it then worked fine. Apologies and grateful thanks.