摘要: spring-boot-maven-plugin是一个springboot maven插件,能够把代码和依赖包打成一个胖jar <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plu 阅读全文
posted @ 2021-04-28 13:59 Mars.wang 阅读(1193) 评论(0) 推荐(0) 编辑
摘要: 有时候我们有多个环境,开发环境、测试环境、生产环境,每个环境都有不同的配置信息 如何用一套代码,在不同环境上都能运行,spring的profile就是用来解决这个问题 比如想着测试环境加载一个配置类,那么这个类可以加上这个注解 一、命令行和@Profile注解用法 @Component @Profi 阅读全文
posted @ 2021-04-28 13:09 Mars.wang 阅读(807) 评论(0) 推荐(0) 编辑
摘要: 一、首先引入spring test依赖 <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <de 阅读全文
posted @ 2021-04-28 12:39 Mars.wang 阅读(284) 评论(0) 推荐(0) 编辑
摘要: 有时候我们在项目里有这样的需求,不在pom文件指定主类,而是在启动时指定主类,这个我研究了半天,发现可用实现,记录一下 有这么几个点需要关注: 1.pom打包的配置 要么指定mainClass,要不就把layout设定为ZIP,里面的原理有机会再深入了解 <build> <plugins> <plu 阅读全文
posted @ 2021-04-28 11:43 Mars.wang 阅读(2728) 评论(0) 推荐(0) 编辑