Like maven's profile replacement plugin
1.You have files such as application.yml or application.yaml, application.properties, etc. in your project, where it says ${spring.active}
spring.profiles.active=${spring.active}
spring:
profiles:
active: ${spring.active}
- Introduce the plugin in the build.gradle.kts file
plugins {
id("com.github.aniaan.gradle-spring-profile") version "1.0.1-RELEASE"
}
- start build
./gradlew clean bootJar -Pprofile=dev
- In your jar, you can see that ${spring.active} has been replaced