摘要: 数据源依赖 druid官方文档:https://github.com/alibaba/druid/wiki/常见问题 mybatis相关依赖及插件配置 对应的application.properties配置: bean 配置 通用Mapper配置 主要配置 通用Mapper插件网址:https:// 阅读全文
posted @ 2018-12-06 20:20 张建斌 阅读(2109) 评论(0) 推荐(0) 编辑
摘要: 添加依赖 spring boot 与 mybatis版本对应关系 http://www.mybatis.org/spring boot starter/mybatis spring boot autoconfigure/ 这里不引入spring boot starter jdbc依赖,是由于myba 阅读全文
posted @ 2018-12-06 18:37 张建斌 阅读(863) 评论(0) 推荐(0) 编辑
摘要: 添加依赖 自定义数据源 spring boot starter jdbc 默认使用tomcat jdbc数据源 数据源配置 配置自己的数据源 定义实体对象 定义dao接口 定义 dao 实现 参考: 原始链接:http://tengj.top/2017/04/13/springboot8/ 阅读全文
posted @ 2018-12-06 17:38 张建斌 阅读(457) 评论(0) 推荐(0) 编辑
摘要: SLF4J定义了统一的日志抽象接口,而真正的日志实现则是在运行时决定的——它提供了各类日志框架的binding。 实际开发中我们不需要直接添加该依赖,你会发现spring boot starter其中包含了 spring boot starter logging,该依赖内容就是 Spring Boo 阅读全文
posted @ 2018-12-06 16:27 张建斌 阅读(308) 评论(0) 推荐(0) 编辑
摘要: WebMvcConfigurerAdapter 使用 1.实现 HandlerInterceptorAdapter 2.添加拦截器 重写WebMvcConfigurerAdapter中的addInterceptors方法 使用Spring Boot的默认配置方式,提供的静态资源映射如下: class 阅读全文
posted @ 2018-12-06 16:08 张建斌 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 外部的Tomcat服务器部署war包 1.继承SpringBootServletInitializer 外部容器部署的话,就不能依赖于Application的main函数了,而是要以类似于web.xml文件配置的方式来启动Spring应用上下文,此时我们需要在启动类中继承SpringBootServ 阅读全文
posted @ 2018-12-06 15:50 张建斌 阅读(692) 评论(0) 推荐(0) 编辑
摘要: 自定义bean属性 1.定义bean属性 2.在属性文件配置 3.启用bean属性配置 @EnableConfigurationProperties({ConfigBean.class, ConfigTestBean.class}) 在配置文件提示自定义属性 1.加依赖 2.mvn compile 阅读全文
posted @ 2018-12-06 14:53 张建斌 阅读(6631) 评论(0) 推荐(0) 编辑
摘要: 创建Spring Boot操作步骤如下: 在File菜单里面选择 New Project,然后选择Spring Initializr 更换版本 或 pom spring boot starter parent是一个特殊的starter,它用来提供相关的Maven默认依赖,使用它之后,常用的包依赖可以 阅读全文
posted @ 2018-12-06 14:08 张建斌 阅读(2862) 评论(0) 推荐(0) 编辑