spring-boot集成sitemesh装饰器

阅读更多

spring-boot-sitemesh, 依赖spring-boot-parent

  • spring-boot
  • EasyUi
  • SiteMesh

项目启动访问路径 http://localhost/admin/index


    org.springframework.boot
    spring-boot-starter-parent
    1.3.5.RELEASE


    org.sitemesh
    sitemesh
    3.0.1
public class WebSiteMeshFilter extends ConfigurableSiteMeshFilter{

    @Override
    protected void applyCustomConfiguration(SiteMeshFilterBuilder builder) {
        builder.addDecoratorPath("/admin/*", "/admin/index")
               .addExcludedPath("/admin/index")
               .addExcludedPath("/plugin/*");
    }
}

@Configuration
public class WebConfig extends WebMvcConfigurerAdapter{
    /**
     * 装饰器
     * @return
     * 2016年8月27日下午12:37:20
     */
    @Bean
    public FilterRegistrationBean siteMeshFilter(){
        FilterRegistrationBean fitler = new FilterRegistrationBean();
        WebSiteMeshFilter siteMeshFilter = new WebSiteMeshFilter();
        fitler.setFilter(siteMeshFilter);
        return fitler;
    }
}

 

 

application.properties

#Server
server.port=80
server.jsp-servlet.class-name=org.apache.jasper.servlet.JspServlet

security.basic.enabled=false
management.security.enabled=false

#MVC
spring.mvc.view.prefix=/WEB-INF/views/
spring.resources.static-locations=classpath:/static/

security.basic.enabled=false
management.security.enabled=false

#LOG
logging.config=classpath:log4j2.xml

 

完整项目路径

https://github.com/leelance/spring-boot-all/tree/master/spring-boot-sitemesh

你可能感兴趣的:(spring-boot,sitemesh,easyui,spring-mvc)