运行一个SpringBoot多模块应用
使用SpringBoot配置启动:
Use classpath of module选中要运行的模块
VM options:内部配置参数
使用maven启动:
不同版本的spring-boot-maven-plugin的jvm参数配置有所不同,同时与通过main方法启动springboot程序传递参数也有所不同。
在运行main方法时,可以通过java -jar 后面通过添加-D的参数即可传递,比如:
java -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 huishi-api-implementation.jar
pom.xml文件配置:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005</jvmArguments>
</configuration>
</plugin>
</plugins>
</build>
此时运行spring-boot:run,是可以正常传递参数。但此时通过mvn spring-boot:run命令来传递参数,参数值将会无效。
同样,即使项目中pom文件配置了上面的plugin,直接通过main方法启动,此参数也是不会生效的。打包部署时依旧需要在执行命令中添加参数项。
这种方式要改动文件,对于提交比较麻烦,不太喜欢。