package org.vaadin.tutorial.spring; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import com.vaadin.flow.server.VaadinServlet; import com.vaadin.flow.tutorial.annotations.CodeFor; /** * The entry point of the Spring Boot application. */ @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Bean public ServletRegistrationBean frontendServletBean() { ServletRegistrationBean bean = new ServletRegistrationBean<>(new VaadinServlet() { @Override protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { if (!serveStaticOrWebJarRequest(req, resp)) { resp.sendError(404); } } }, "/frontend/*"); bean.setLoadOnStartup(1); return bean; } }