Reputation: 6971
I'm trying to reproduce a simplified version of the official Vaadin Dashboard Demo, but I'm using Spring Boot for managing dependencies.
In DashboardServlet.java
file you will find this code:
public class DashboardServlet extends VaadinServlet {
@Override
protected final void servletInitialized() throws ServletException {
super.servletInitialized();
getService().addSessionInitListener(new DashboardSessionInitListener());
}
}
The demo is using a customized servlet.
Question: how can this be achieved in Spring Boot? How can I make Spring Boot inject my custom servlet class?
Upvotes: 2
Views: 2855
Reputation: 4967
You must create a manage bean which name is vaadinServlet
, and you want to extend the SpringVaadinServlet
class. This should work:
@Component("vaadinServlet")
public class MySpringVaadinServlet extends SpringVaadinServlet {
@Override
protected void servletInitialized() throws ServletException {
super.servletInitialized();
}
}
Upvotes: 5