Springboot, Vaadin and RestController

Viewed 730

I created a new project with spring boot that includes vaadin and springmvc.

I added a restcontroller class and a vaadin view class annotated with @Route, yet when trying to access the view I receive a blank pages and a lot of failed http request with 405 access code to /VAADIN and /frontend paths.

When removing the restcontroller, the vaadin view worked.

1 Answers

The solution was adding a servlet mapping to the vaadin resources:

@WebServlet(
    urlPatterns = {
            "/VAADIN/*", "/frontend/*"
    },
    initParams = {
            @WebInitParam(name = "productionMode", value = "false")
    })
public class MyServlet extends VaadinServlet {}

Don't forget to add @ServletComponentScan annotation.

Related