From b9ddeb807bb2074442676a44f5d5492536c4492f Mon Sep 17 00:00:00 2001 From: j-sandy <30489233+j-sandy@users.noreply.github.com> Date: Mon, 23 Jan 2023 06:00:29 +0000 Subject: [PATCH] chore(web): clean up for spring property setup Using `com.netflix.spinnaker.kork.boot.DefaultPropertiesBuilder` class to setup spring and other related properties required for the spring boot application to start. --- gate-web/gate-web.gradle | 1 + .../groovy/com/netflix/spinnaker/gate/Main.groovy | 11 ++--------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/gate-web/gate-web.gradle b/gate-web/gate-web.gradle index dd6638685a..3e0fcafff4 100644 --- a/gate-web/gate-web.gradle +++ b/gate-web/gate-web.gradle @@ -28,6 +28,7 @@ dependencies { implementation "io.spinnaker.fiat:fiat-core:$fiatVersion" implementation "io.spinnaker.fiat:fiat-api:$fiatVersion" + implementation "io.spinnaker.kork:kork-config" implementation "io.spinnaker.kork:kork-plugins" implementation "io.spinnaker.kork:kork-web" implementation "com.netflix.frigga:frigga" diff --git a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/Main.groovy b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/Main.groovy index a7fab3f352..2fd1db765e 100644 --- a/gate-web/src/main/groovy/com/netflix/spinnaker/gate/Main.groovy +++ b/gate-web/src/main/groovy/com/netflix/spinnaker/gate/Main.groovy @@ -24,6 +24,7 @@ import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration import org.springframework.boot.builder.SpringApplicationBuilder import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.scheduling.annotation.EnableAsync +import com.netflix.spinnaker.kork.boot.DefaultPropertiesBuilder @EnableAsync @EnableConfigurationProperties @@ -41,15 +42,7 @@ import org.springframework.scheduling.annotation.EnableAsync ) class Main { - static final Map DEFAULT_PROPS = [ - 'netflix.environment': 'test', - 'netflix.account': '${netflix.environment}', - 'netflix.stack': 'test', - 'spring.config.additional-location': '${user.home}/.spinnaker/', - 'spring.application.name': 'gate', - 'spring.config.name': 'spinnaker,${spring.application.name}', - 'spring.profiles.active': '${netflix.environment},local' - ] + static final Map DEFAULT_PROPS = new DefaultPropertiesBuilder().property("spring.application.name", "gate").build() static void main(String... args) { new SpringApplicationBuilder().properties(DEFAULT_PROPS).sources(Main).run(args)