|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.boot.context.initializer.ConfigFileApplicationContextInitializer
public class ConfigFileApplicationContextInitializer
ApplicationContextInitializer that configures the context environment by
loading properties from well known file locations. By default properties will be loaded
from 'application.properties' and/or 'application.yml' files in the following
locations:
Alternative locations and names can be specified using
setSearchLocations(String[]) and setNames(String).
Additional files will also be loaded based on active profiles. For example if a 'web' profile is active 'application-web.properties' and 'application-web.yml' will be considered.
The 'spring.config.name' property can be used to specify an alternative name to load or alternatively the 'spring.config.location' property can be used to specify an exact resource location.
| Field Summary |
|---|
| Fields inherited from interface org.springframework.core.Ordered |
|---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
| Constructor Summary | |
|---|---|
ConfigFileApplicationContextInitializer()
|
|
| Method Summary | |
|---|---|
int |
getOrder()
|
void |
initialize(org.springframework.context.ConfigurableApplicationContext applicationContext)
|
void |
initialize(SpringApplication springApplication,
String[] args)
Binds the early Environment to the SpringApplication. |
void |
setEnvironment(org.springframework.core.env.Environment environment)
|
void |
setNames(String names)
Sets the names of the files that should be loaded (excluding file extension) as a comma separated list. |
void |
setOrder(int order)
|
void |
setSearchLocations(String[] searchLocations)
Set the search locations that will be considered. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConfigFileApplicationContextInitializer()
| Method Detail |
|---|
public void initialize(SpringApplication springApplication,
String[] args)
Environment to the SpringApplication. This makes it
possible to set SpringApplication properties dynamically, like the sources
("spring.main.sources" - a CSV list) the flag to indicate a web environment
("spring.main.web_environment=true") or the flag to switch off the banner
("spring.main.show_banner=false").
initialize in interface SpringApplicationInitializerspringApplication - the spring application.args - the run argumentspublic void initialize(org.springframework.context.ConfigurableApplicationContext applicationContext)
initialize in interface org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>public void setEnvironment(org.springframework.core.env.Environment environment)
setEnvironment in interface org.springframework.context.EnvironmentAwarepublic void setOrder(int order)
public int getOrder()
getOrder in interface org.springframework.core.Orderedpublic void setNames(String names)
public void setSearchLocations(String[] searchLocations)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||