spring-boot集成Freemarker开发
2016-10-10 21:43
260 查看
1.该demo功能
http://localhost/system/login展示后台发布新闻列表 http://localhost/前端Freemark模板展示
中间用到了Mysql, Mybatis, druid;可以参考spring-boot相关的demo
2.Pom依赖
3.项目启动
4.配置freemarker
5.完整项目参考
https://github.com/leelance/spring-boot-all/tree/master/spring-boot-freemarker
http://localhost/system/login展示后台发布新闻列表 http://localhost/前端Freemark模板展示
中间用到了Mysql, Mybatis, druid;可以参考spring-boot相关的demo
2.Pom依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-freemarker</artifactId> </dependency>
3.项目启动
@SpringBootApplication @MapperScan(basePackages="com.lance.freemaker.mapper") public class SimpleApplication { public static void main(String[] args) { SpringApplication.run(SimpleApplication.class, args); } } @Configuration public class WebMvcConfig extends WebMvcConfigurerAdapter{ @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new AdminInterceptor()).addPathPatterns("/system/admin/**"); } }
4.配置freemarker
# FREEMARKER (FreeMarkerAutoConfiguration) spring.freemarker.allow-request-override=false spring.freemarker.allow-session-override=false spring.freemarker.cache=true spring.freemarker.charset=UTF-8 spring.freemarker.check-template-location=true spring.freemarker.content-type=text/html spring.freemarker.enabled=true spring.freemarker.expose-request-attributes=false spring.freemarker.expose-session-attributes=false spring.freemarker.expose-spring-macro-helpers=true spring.freemarker.prefer-file-system-access=true spring.freemarker.suffix=.ftl spring.freemarker.template-loader-path=classpath:/templates/ spring.freemarker.settings.template_update_delay=0 spring.freemarker.settings.default_encoding=UTF-8 spring.freemarker.settings.classic_compatible=true spring.freemarker.order=1
5.完整项目参考
https://github.com/leelance/spring-boot-all/tree/master/spring-boot-freemarker
相关文章推荐
- Spring Boot 集成 FreeMarker 详解案例
- Spring Boot 集成 FreeMarker
- springboot---->集成mybatis开发(二)
- spring boot + vue + element-ui全栈开发入门——集成element-ui
- SpringBoot集成Mybatis(基于注解式开发)
- Spring Boot 学习笔记【6】使用FreeMarker与BootStrap开发Web
- Kotlin集成 SpringBoot 混合Java库开发
- springboot---->集成mybatis开发(一)
- Spring Boot 集成 FreeMarker 详解案例
- Spring Boot与Spark、Cassandra系统集成开发示例
- Spring Boot实践-3(集成freemarker)
- Spring Boot与FreeMarker集成后配置全局模板转义html/xml
- Spring Boot 系列 - web开发 Thymeleaf、FreeMarker模板引擎
- Springboot 和 Mybatis集成开发
- 从0开始学习SpringCould(4)--SpringBoot 集成freemarker
- springBoot(5):web开发-模板引擎FreeMarker与thymeleaf
- springboot 集成freemarker
- 微服务开发的入门级框架Spring Boot详解:集成Mybatis
- Spring Boot 集成 FreeMarker 详解案例
- 创建maven spring boot的RESTful Web Service工程(使用IntelliJ IDEA以及无集成开发环境)