Vaadin Spring Boot integration - custom servlet

Hi,

I need to get rid of the vaadin red error message when someone tries to interact with the application
after session timeout. According to book and few forum posts I would need to extends vaadin
servlet to do that. Since I use spring boot integration - how do I go about that ? I tried to simply
create a new servlet and return it as a bean in my application configuration class but that does not seem
to work properly. Any suggestions please ?

Thanks,
Adrian

[code]

@Bean(name=“springBootServletRegistrationBean”)
public ServletRegistrationBean servletRegistrationBean() {
SpringVaadinServlet servlet = new SpringVaadinServlet() {

        private static final long serialVersionUID = 1L;

        class MySystemMessagesProvider implements SystemMessagesProvider {

            private static final long serialVersionUID = 1L;

            @Override
            public SystemMessages getSystemMessages(SystemMessagesInfo systemMessagesInfo) {
                CustomizedSystemMessages messages = new CustomizedSystemMessages();                    
                messages.setCommunicationErrorCaption("Error - bla bla bla");

                return messages;
            }
            
        }

        @Override
        public void servletInitialized() throws ServletException {
            super.servletInitialized();                
            getService().addSessionInitListener(new SessionInitListener() {

                private static final long serialVersionUID = 1L;

                public void sessionInit(SessionInitEvent event) throws ServiceException {
                    event.getService().setSystemMessagesProvider(new MySystemMessagesProvider());
                }
                
            });
        }
        
    };
    
    return new ServletRegistrationBean(servlet, "/UI/*");
}

[/code]

​That seems to be working properly !