我有一个maven作为构建工具的应用程序.
我正在使用maven配置文件来设置不同配置文件的不同属性.
我想要做的是maven中的所有活动配置文件也将被移植到spring active配置文件中,所以我可以在bean signature(@profile)中引用它们.但我不知道该怎么做.
例如:考虑以下maven设置
<profiles>
<profile>
<id>profile1</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
</properties>
</profile>
<profile>
<id>profile2</id>
<properties>
</properties>
</profile>
<profile>
<id>development</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
</properties>
</profile>
<profile>
<id>production</id>
<properties>
</properties>
</profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)
假设我运行maven而没有指定我希望Spring拥有的任何其他配置文件profile1以及 development作为活动配置文件.
在Spring-Tools-suite(Eclipse的定制版本)中,有一个选项可以为同一应用程序定义多个运行配置,然后运行它们。
例如,在测试Eureka Server并使用不同的端口和名称定义运行同一应用程序的多个实例以检查注册时。
有谁知道使用Spring和Java Extensions和Visual Studio Code定义类似运行配置的方法吗?
我有一个部署到外部tomcat服务器的springboot应用程序,一切都在本地DB上运行.现在,我必须将代码推广到数据库配置不同的更高环境.我阅读了很多关于配置文件-Dspring.profiles.active=dev等等的内容,但是当它的外部tomcat没有使用时,spring项目将如何知道它所在的服务器
java -jar -Dspring.profiles.active=dev demo-0.0.1-SNAPSHOT.jar