Spring boot from sitemesh

I am using spring loading and I would like to use sitemesh3 for my project. I need to add a sitemesh filter, I create this class:

@Configuration
public class Initializer implements ServletContextInitializer{


    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {

        //Sitemesh
        FilterRegistration.Dynamic sitemesh = servletContext.addFilter("sitemesh", new ConfigurableSiteMeshFilter());
        EnumSet<DispatcherType> sitemeshDispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD);
        sitemesh.addMappingForUrlPatterns(sitemeshDispatcherTypes, true, "*.jsp");



    }
} 

I created a file sitemesh3.xmlin the WEB-INF directory, but nothing happened, did I miss some configuration?

+4
source share
1 answer

ServletContextInitializerdo not boot using Spring Boot. Add a filter to your application configuration and wrap it in FilterRegistrationBean.

See the Spring Boot reference guide .

+3
source

Source: https://habr.com/ru/post/1539918/


All Articles