随笔分类 - spring-boot
spring-boot学习
摘要:如何在spring-boot中使用Redis工具类 修改pom.xml文件 新增spring-boot-starter-data-redis配置 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-b
阅读全文
摘要:背景 如何使用druid 连接池配置多个数据源 参考文档:https://www.cnblogs.com/qdhxhz/p/10192041.html 目录结构 为了更好的区分,我把不同的数据库,新建在不同的目录下面 先看目录结构: 修改配置 pom.xml <dependency> <groupI
阅读全文
摘要:添加配置 修改pom.xml文件 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> <dependency> <groupId>com.alibaba</
阅读全文
摘要:修改配置文件 pom.xml中新增数据库配置 <?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLS
阅读全文
摘要:文章背景 本文介绍如果在spring boot中接入apollo 官方文档:https://github.com/ctripcorp/apollo/wiki#%E4%B8%80%E6%99%AE%E9%80%9A%E5%BA%94%E7%94%A8%E6%8E%A5%E5%85%A5%E6%8C%8
阅读全文
摘要:官方文档 https://github.com/pagehelper/Mybatis-PageHelper/blob/master/wikis/zh/HowToUse.md 引入分页类 pom.xml中 <dependency> <groupId>com.github.pagehelper</gro
阅读全文
摘要:背景 我发现上传到github上的项目,有的有Example类,有的没有Example类,怎么回事呢? 过程 对比项目,发现/src/main/resources/mybatis/generatorConfig.xml 类不一样。 原因 targetRuntime="Mybatis" 和 targe
阅读全文
摘要:在pom.xml中添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <version>2.2.1.RELEASE<
阅读全文
摘要:在做项目时,发现项目中 加载类时,有的地方使用@Autowired,有的地方使用@Resource 在网上搜集了资料 共同点 @Resource和@Autowired都可以作为注入属性的修饰,在接口仅有单一实现类时,两个注解的修饰效果相同,可以互相替换,不影响使用。 不同点 @Resource是Ja
阅读全文
摘要:初始化项目 com.example.mybatisgeneratordemo 最终的文件目录结构 配置pom.xml文件 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"
阅读全文
摘要:新建项目 设置项目名称 设置为Web项目 工程初始化 目录结构 相关配置文件修改 配置pom.xml文件 1.修改pom.xml文件,添加mybatis配置 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java<
阅读全文
摘要:现在主流的都使用logback+slf4j进行日志打印。 slf4j 需要配置maven <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> logback-s
阅读全文
摘要:application.yml server: port: 8090 servlet: context-path: /springboot HelloController package com.komiles.study.controller; import org.springframework
阅读全文