摘要:
一、案例 1.1 引入maven依赖 1.2 配置application.properties 1.3 配置config/ehcache.xml 1.4 启用@EnableCaching 注解支持 1.5 编写实体类 如下代码,写完后运行Springboot01Application.java会自动 阅读全文
posted @ 2017-12-11 23:34
shyroke、
阅读(4893)
评论(0)
推荐(1)
摘要:
一、简介 ssh ssm都有事务管理service层通过applicationContext.xml配置,所有service方法都加上事务操作; 用来保证一致性,即service方法里的多个dao操作,要么同时成功,要么同时失败; springboot下的话,在service方法上加上@Transa 阅读全文
posted @ 2017-12-11 21:03
shyroke、
阅读(11638)
评论(0)
推荐(0)
摘要:
一、案例 1.1 配置application.properties spring.http.multipart.enabled=true #默认支持文件上传. spring.http.multipart.file-size-threshold=0 #支持文件写入磁盘. spring.http.mul 阅读全文
posted @ 2017-12-11 17:22
shyroke、
阅读(8515)
评论(0)
推荐(0)
摘要:
一.需求 Web 开发使用 Controller 基本上可以完成大部分需求,但是我们还可能会用到 Servlet、 FilterListene 二、案例 2.1 通过注册 ServletRegistrationBean、 FilterRegistrationBean 和ServletListener 阅读全文
posted @ 2017-12-11 16:49
shyroke、
阅读(670)
评论(0)
推荐(0)
摘要:
一、错误处理方法 1.Spring Boot 将所有的错误默认映射到/error, 实现ErrorController 2.添加自定义的错误页面 二、Spring Boot 将所有的错误默认映射到/error, 实现ErrorController 2.1 编写ErrorController 2.2 阅读全文
posted @ 2017-12-11 16:17
shyroke、
阅读(5703)
评论(0)
推荐(0)
摘要:
一、概念 jsp应该尽量避免使用,原因如下: 二、案例 2.1 引入maven依赖 jsp和jstl依赖必须都引入。 2.2 配置application.properties 2.3 编写控制器 2.4 index.jsp 2.5 js和css 2.6 结果 阅读全文
posted @ 2017-12-11 15:17
shyroke、
阅读(2853)
评论(0)
推荐(0)
摘要:
一、案例 1.1 pom.xml 1.2 application.properties 1.3 编写控制器 1.5 编写index.ftl 1.6 index.js 1.7 index.css 1.8 目录结构 结果 结果 阅读全文
posted @ 2017-12-11 14:30
shyroke、
阅读(33868)
评论(0)
推荐(1)
摘要:
一、freemarker模板文件(*.ftl)的基本组成部分 1. 文本:直接输出的内容部分 2. 注释:不会输出的内容,格式为<#-- 注释内容 --> 3. 取值(插值):代替输出数据模型的部分,格式为${数据模型}或#{数据模型} 4. ftl指令:Freemarker指令,类似于HTML标记 阅读全文
posted @ 2017-12-11 13:49
shyroke、
阅读(1332)
评论(0)
推荐(0)