Commit 9d0ac868 authored by Phillip Webb's avatar Phillip Webb

Polish

parent 03667c7d
...@@ -276,14 +276,14 @@ or ...@@ -276,14 +276,14 @@ or
$ java -jar myproject.jar --spring.config.location=classpath:/default.properties,classpath:/override.properties $ java -jar myproject.jar --spring.config.location=classpath:/default.properties,classpath:/override.properties
---- ----
If `spring.config.location` contains directories (as opposed to files) If `spring.config.location` contains directories (as opposed to files) they should end
they should end in "/" (and will be appended with the names generated in `/` (and will be appended with the names generated from `spring.config.name` before
from `spring.config.name` before being loaded). The default search being loaded). The default search path `classpath:,classpath:/config,file:,file:config/`
path `classpath:,classpath:/config,file:,file:config/` is always used, is always used, irrespective of the value of `spring.config.location`. In that way you
irrespective of the value of `spring.config.location`. In that way you can set up default values for your application in `application.properties` (or whatever
can set up default values for your app in `application.properties` (or other basename you choose with `spring.config.name`) and override it at runtime with a
whatever other basename you choose with `spring.config.name`) and different file, keeping the defaults.
override it at runtime with a different file, keeping the defaults.
[[boot-features-external-config-profile-specific-properties]] [[boot-features-external-config-profile-specific-properties]]
......
/* /*
* Copyright 2012-2013 the original author or authors. * Copyright 2012-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
...@@ -68,26 +68,24 @@ public class PropertySourcesLoader { ...@@ -68,26 +68,24 @@ public class PropertySourcesLoader {
* @throws IOException * @throws IOException
*/ */
public PropertySource<?> load(Resource resource) throws IOException { public PropertySource<?> load(Resource resource) throws IOException {
return this.load(resource, null); return load(resource, null);
} }
/** /**
* Load the profile-specific properties from the specified resource (if any) and add * Load the profile-specific properties from the specified resource (if any) and add
* it as the first source. * it as the first source.
*
* @param resource the source resource (may be {@code null}). * @param resource the source resource (may be {@code null}).
* @param profile a specific profile to load or {@code null} to load the default. * @param profile a specific profile to load or {@code null} to load the default.
* @return the loaded property source or {@code null} * @return the loaded property source or {@code null}
* @throws IOException * @throws IOException
*/ */
public PropertySource<?> load(Resource resource, String profile) throws IOException { public PropertySource<?> load(Resource resource, String profile) throws IOException {
return this.load(resource, resource.getDescription(), profile); return load(resource, resource.getDescription(), profile);
} }
/** /**
* Load the profile-specific properties from the specified resource (if any), give the * Load the profile-specific properties from the specified resource (if any), give the
* name provided and add it as the first source. * name provided and add it as the first source.
*
* @param resource the source resource (may be {@code null}). * @param resource the source resource (may be {@code null}).
* @param name the root property name (may be {@code null}). * @param name the root property name (may be {@code null}).
* @param profile a specific profile to load or {@code null} to load the default. * @param profile a specific profile to load or {@code null} to load the default.
...@@ -96,7 +94,7 @@ public class PropertySourcesLoader { ...@@ -96,7 +94,7 @@ public class PropertySourcesLoader {
*/ */
public PropertySource<?> load(Resource resource, String name, String profile) public PropertySource<?> load(Resource resource, String name, String profile)
throws IOException { throws IOException {
return this.load(resource, null, name, profile); return load(resource, null, name, profile);
} }
/** /**
...@@ -108,7 +106,6 @@ public class PropertySourcesLoader { ...@@ -108,7 +106,6 @@ public class PropertySourcesLoader {
* groups afterwards (with the highest priority last). Property resolution from the * groups afterwards (with the highest priority last). Property resolution from the
* resulting sources will consider all keys for a given group first and then move to * resulting sources will consider all keys for a given group first and then move to
* the next group. * the next group.
*
* @param resource the source resource (may be {@code null}). * @param resource the source resource (may be {@code null}).
* @param group an identifier for the group that this source belongs to * @param group an identifier for the group that this source belongs to
* @param name the root property name (may be {@code null}). * @param name the root property name (may be {@code null}).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment