spring项目获取ApplicationContext(能手动从Spring获取所需要的bean)
摘要:最流行的方法就是 实现ApplicationContextAware接口 @Component public class SpringContextUtil implements ApplicationContextAware { private static ApplicationContext
阅读全文
Spring切换多个配置环境(dev,prod,test等)
摘要:默认有一个application.properties配置文件, 然后在resource目录下新建3个配置文件比如 application-dev.properties application-test.properties application-prod.properties 比如我们要使用de
阅读全文
springboot通过poi导出excel
摘要:Maven引入依赖 导出excel 导出excel比较重要的api有以下几个,其他的并无难点 创建一个excel文件工作薄;(HSSFWorkbook workbook = new HSSFWorkbook()) 创建一张表;HSSFSheet sheet = workbook.createShee
阅读全文
Spring Boot 整合mybatis-generator
摘要:Maven 引入 mybatis-generator插件 mybatis-generator.xml 内容为 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org/
阅读全文
spring boot 整合pagehelper分页插件
摘要:Spring Boot 整合pagehelper分页插件 测试环境: spring boot 版本 2.0.0.M7 mybatis starter 版本 1.3.1 jdk 1.8 1. maven 引入 pagehelper 相关Jar包 2. Service层代码 只需添加一句核心分页代码 (
阅读全文
解决idea spring boot项目中target中没有同步更新最新目录文件及资源
摘要:idea不像eclipse那样自动将新保存的文件或目录及其他资源更新到target目录中,必须在pom.xml中设置 这样maven clean 就可以了!
阅读全文