韩国做美食网站,笔记本做网站,网页制作步骤详细,wordpress 用户枚举版本说明
GraalVM JDK 21.0.3Gradle 8.7Spring Boot 3.2.5
目录结构 指定环境打包
application.yml/yaml/properties
执行 bootJar 打包命令前要先执行 clean【其它和 processResources 相关的命令也要先执行 clean】#xff0c;否则 active 值不会变#xff01;
spring…版本说明
GraalVM JDK 21.0.3Gradle 8.7Spring Boot 3.2.5
目录结构 指定环境打包
application.yml/yaml/properties
执行 bootJar 打包命令前要先执行 clean【其它和 processResources 相关的命令也要先执行 clean】否则 active 值不会变
spring:profiles:# 执行 bootJar 打包命令前要先执行 clean【其它和 processResources 相关的命令也要先执行 clean】否则 active 值不会变active: activeProfilesbuild.gradle 修改 processResources 任务
def activeProfiles project.properties[activeProfiles] ?: dev
processResources {exclude {FileTreeElement details -{(//排除不是当前环境的 yml 配置文件details.file.name.startsWith(application-) details.file.name.endsWith(.yml) !details.file.name.equals(application.yml) !details.file.name.equals(application- activeProfiles .yml)) || (//排除不是当前环境的 yaml 配置文件details.file.name.startsWith(application-) details.file.name.endsWith(.yaml) !details.file.name.equals(application.yaml) !details.file.name.equals(application- activeProfiles .yaml)) || (//排除不是当前环境的 properties 配置文件details.file.name.startsWith(application-) details.file.name.endsWith(.properties) !details.file.name.equals(application.properties) !details.file.name.equals(application- activeProfiles .properties))}}filter ReplaceTokens, tokens: [activeProfiles: activeProfiles]
}打包
因为没有指定环境默认dev
可以先在build/resources/main目录下查看是否只包含对应环境的文件 jar包里的文件和变量也对的上
指定test环境打包 bootJar追加application.yml配置的spring.profiles.active的activeProfiles变量名并指定环境为test后点ok保存 先clean再bootJar否则不会生效 打包输出到控制台的命令可以查看配置有没有生效 查看文件是否符合预期