Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load properties straight into Spring Boot #131

Merged
merged 1 commit into from
Oct 27, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions gate-web/src/main/groovy/com/netflix/spinnaker/gate/Main.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
*/

package com.netflix.spinnaker.gate

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet
import com.netflix.spinnaker.hystrix.spectator.HystrixSpectatorConfig
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration
Expand Down Expand Up @@ -48,23 +46,13 @@ class Main extends SpringBootServletInitializer {
'spring.profiles.active': "${System.getProperty('netflix.environment', 'test')},local"
]

static {
applyDefaults()
}

static void applyDefaults() {
DEFAULT_PROPS.each { k, v ->
System.setProperty(k, System.getProperty(k, v))
}
}

static void main(String... args) {
SpringApplication.run this, args
new SpringApplicationBuilder().properties(DEFAULT_PROPS).sources(Main).run(args)
}

@Override
SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
builder.sources(Main)
builder.properties(DEFAULT_PROPS).sources(Main)
}

@Bean
Expand Down