Vaadin 10 spring boot issue

Hi

i have an issue with vaadin 10 using spring boot. I have setup spring boot to work with a simple view (view just extends vertical layout and has a label which prints hello. This works fine. but if i move the view to a different package the route is no longer seem to vaadin or its not loaded up during startup.

has anyone seen this? is there something i am missing to get this to work?

i don’t really want to put all my views in tje same package so any help woild be grateful

Hi Peter,

Check Application.java. You need to have the upper-most view listed in the scanBasePackageClasses annotation:

@SpringBootApplication(scanBasePackageClasses = { MainView.class})

The above example will include MainView and all views that are under MainView. For example if you have:

myapp.ui.MainView
myapp.ui.setup.UserSetupView
myapp.ui.setup.ProductSetupView

All three views will be included. However, if you have:

myapp.ui.main.MainView
myapp.ui.setup.UserSetupView
myapp.ui.setup.ProductSetupView

Spring will only find MainView and you’ll need to include UserSetupView in the scan. I think that Spring will pick up ProductSetupView automatically, but not 100% sure.

Thanks, that worked

I have the same exact issue but I have all my views in a package that is under the main package with the main class. I found that using @Route(value=“”) works and is recognized by spring boot. But if I don’t specify the value property and put only the string in it doesn’t work. Says Could not navigate to “view name”. I have a button in the first view and when I try to navigate to another view on button click the samee problem occurs. Why is this happening?