Spring Boot基础6-web应用开发-模板引擎FreeMarker
2016-10-10 12:00
851 查看
原文参考:http://www.roncoo.com/article/detail/125487
一.spring boot的web应用开发,是基于spring mvc
二.Spring boot 在spring默认基础上,自动配置添加了以下特性:
1. 包含了ContentNegotiatingViewResolver和BeanNameViewResolver beans。
2. 对静态资源的支持,包括对WebJars的支持。
3. 自动注册Converter,GenericConverter,Formatter beans。
4. 对HttpMessageConverters的支持。
5. 自动注册MessageCodeResolver。
6. 对静态index.html的支持。
7. 对自定义Favicon的支持。
8. 主动使用ConfigurableWebBindingInitializer bean
三.模板引擎的选择
FreeMarker
Thymeleaf
Velocity (1.4版本之后弃用,Spring Framework 4.3版本之后弃用)
Groovy
Mustache
注:jsp应该尽量避免使用,原因如下:
1. jsp只能打包为:war格式,不支持jar格式,只能在标准的容器里面跑(tomcat,jetty都可以)
2. 内嵌的Jetty目前不支持JSPs
3. Undertow不支持jsps
4. jsp自定义错误页面不能覆盖spring
boot 默认的错误页面
四.FreeMarker Demo
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
一.spring boot的web应用开发,是基于spring mvc
二.Spring boot 在spring默认基础上,自动配置添加了以下特性:
1. 包含了ContentNegotiatingViewResolver和BeanNameViewResolver beans。
2. 对静态资源的支持,包括对WebJars的支持。
3. 自动注册Converter,GenericConverter,Formatter beans。
4. 对HttpMessageConverters的支持。
5. 自动注册MessageCodeResolver。
6. 对静态index.html的支持。
7. 对自定义Favicon的支持。
8. 主动使用ConfigurableWebBindingInitializer bean
三.模板引擎的选择
FreeMarker
Thymeleaf
Velocity (1.4版本之后弃用,Spring Framework 4.3版本之后弃用)
Groovy
Mustache
注:jsp应该尽量避免使用,原因如下:
1. jsp只能打包为:war格式,不支持jar格式,只能在标准的容器里面跑(tomcat,jetty都可以)
2. 内嵌的Jetty目前不支持JSPs
3. Undertow不支持jsps
4. jsp自定义错误页面不能覆盖spring
boot 默认的错误页面
四.FreeMarker Demo
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
相关文章推荐
- Spring Boot基础教程9-web应用开发-错误处理
- Spring Boot基础教程12-web应用开发-文件上传
- Spring Boot基础7-web应用开发-模板引擎Thymeleaf
- Spring Boot基础教程11-web应用开发-CORS支持
- Spring Boot基础教程8-web应用开发-模板引擎jsp
- Spring Boot - Web 应用开发 - 文件上传
- Spring Boot干货系列:(五)开发Web应用之JSP篇
- SpringBoot | 第十七章:web应用开发之文件上传
- (十)SpringBoot之web 应用开发-Servlets, Filters, listeners
- Spring Boot: 开发web 应用 - 03 Spring Framework 回顾
- 使用Spring Boot搭建应用开发框架(一) —— 基础架构(转载)
- Spring Boot: 开发web 应用 - 04 (Optional) Web MVC - Look Under The Hood
- SpringBoot | 第十七章:web应用开发之文件上传
- Spring Boot ---- 快速开发web应用的神器
- Spring Boot - Web 应用开发 - Servlet, Filter, Listener
- (十)SpringBoot之web 应用开发-Servlets, Filters, listeners
- spring-boot快速搭建web应用教程一-基础环境搭建
- 【Spring Boot】web应用开发-Servlets, Filters, listeners
- Spring Boot 教程(四) -- 开发 Web 应用