Skip to content

Commit 3050d71

Browse files
Christopher Frostnebhale
authored andcommitted
Expand the documentation around Spring profiles
This commit adds information about Spring profiles to the documentation for auto-reconfiguration. It also expands the documentation about Spring profiles for each of the relavent containers. [#76772236]
1 parent 01c4221 commit 3050d71

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

docs/container-dist_zip.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ The Dist Zip Container allows applications packaged in [`distZip`-style][] to be
1616
</table>
1717
Tags are printed to standard output by the buildpack detect script
1818

19+
If the application uses Spring, [Spring profiles][] can be specified by setting the [`SPRING_PROFILES_ACTIVE`][] environment variable. This is automatically detected and used by Spring. The Spring Auto-reconfiguration Framework will specify the `cloud` profile in addition to any others.
20+
1921
## Configuration
2022
The Dist Zip Container cannot be configured.
2123

22-
2324
[`distZip`-style]: http://www.gradle.org/docs/current/userguide/application_plugin.html
25+
[Spring profiles]:http://blog.springsource.com/2011/02/14/spring-3-1-m1-introducing-profile/
26+
[`SPRING_PROFILES_ACTIVE`]: http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/core/env/AbstractEnvironment.html#ACTIVE_PROFILES_PROPERTY_NAME

docs/container-java_main.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Command line arguments may optionally be configured.
1818
</table>
1919
Tags are printed to standard output by the buildpack detect script
2020

21+
If the application uses Spring, [Spring profiles][] can be specified by setting the [`SPRING_PROFILES_ACTIVE`][] environment variable. This is automatically detected and used by Spring. The Spring Auto-reconfiguration Framework will specify the `cloud` profile in addition to any others.
22+
2123
## Spring Boot
2224

2325
If the main class is Spring Boot's `JarLauncher`, `PropertiesLauncher` or `WarLauncher`, the Java Main Container adds a `--server.port` argument to the command so that the application uses the correct port.
@@ -32,3 +34,5 @@ The container can be configured by creating or modifying the `config/java_main.y
3234
| `java_main_class` | The Java class name to run. Values containing whitespace are rejected with an error, but all others values appear without modification on the Java command line. If not specified, the Java Manifest value of `Main-Class` is used.
3335

3436
[Configuration and Extension]: ../README.md#configuration-and-extension
37+
[Spring profiles]:http://blog.springsource.com/2011/02/14/spring-3-1-m1-introducing-profile/
38+
[`SPRING_PROFILES_ACTIVE`]: http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/core/env/AbstractEnvironment.html#ACTIVE_PROFILES_PROPERTY_NAME

docs/container-spring_boot.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ Tags are printed to standard output by the buildpack detect script
1515

1616
The container expects to run the application creating by running [`gradle distZip`][d] in an application built with the Spring Boot Gradle plugin.
1717

18+
If the application uses Spring, [Spring profiles][] can be specified by setting the [`SPRING_PROFILES_ACTIVE`][] environment variable. This is automatically detected and used by Spring. The Spring Auto-reconfiguration Framework will specify the `cloud` profile in addition to any others.
19+
1820
## Configuration
1921
The Spring Boot Container cannot be configured.
2022

2123
[d]: http://docs.spring.io/spring-boot/docs/1.0.1.RELEASE/reference/htmlsingle/#using-boot-gradle
2224
[s]: http://projects.spring.io/spring-boot/
25+
[Spring profiles]:http://blog.springsource.com/2011/02/14/spring-3-1-m1-introducing-profile/
26+
[`SPRING_PROFILES_ACTIVE`]: http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/core/env/AbstractEnvironment.html#ACTIVE_PROFILES_PROPERTY_NAME

docs/container-spring_boot_cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The Spring Boot CLI Container runs one or more Groovy (i.e. `*.groovy`) files us
1919
</table>
2020
Tags are printed to standard output by the buildpack detect script.
2121

22-
In order to specify [Spring profiles][], set the [`SPRING_PROFILES_ACTIVE`][] environment variable. This is automatically detected and used by Spring.
22+
If the application uses Spring, [Spring profiles][] can be specified by setting the [`SPRING_PROFILES_ACTIVE`][] environment variable. This is automatically detected and used by Spring. The Spring Auto-reconfiguration Framework will specify the `cloud` profile in addition to any others.
2323

2424
## Configuration
2525
For general information on configuring the buildpack, refer to [Configuration and Extension][].

docs/container-tomcat.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The Tomcat Container allows servlet 2 and 3 web applications to be run. These a
1212
</table>
1313
Tags are printed to standard output by the buildpack detect script
1414

15-
In order to specify [Spring profiles][], set the [`SPRING_PROFILES_ACTIVE`][] environment variable. This is automatically detected and used by Spring.
15+
If the application uses Spring, [Spring profiles][] can be specified by setting the [`SPRING_PROFILES_ACTIVE`][] environment variable. This is automatically detected and used by Spring. The Spring Auto-reconfiguration Framework will specify the `cloud` profile in addition to any others.
1616

1717
## Configuration
1818
For general information on configuring the buildpack, refer to [Configuration and Extension][].

docs/framework-spring_auto_reconfiguration.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The Spring Auto-reconfiguration Framework causes an application to be automatica
1313
</table>
1414
Tags are printed to standard output by the buildpack detect script
1515

16-
If a `/WEB-INF/web.xml` file exists, the framework will modify it in addition to making the auto-reconfiguration JAR available on the classpath. This modification consists of adding `org.cloudfoundry.reconfiguration.spring.CloudProfileApplicationContextInitializer`, `org.cloudfoundry.reconfiguration.spring.CloudPropertySourceApplicationContextInitializer`, and `org.cloudfoundry.reconfiguration.spring.CloudAutoReconfigurationApplicationContextInitializer` to the collection of `contextInitializerClasses`.
16+
If a `/WEB-INF/web.xml` file exists, the framework will modify it in addition to making the auto-reconfiguration JAR available on the classpath. This modification consists of adding `org.cloudfoundry.reconfiguration.spring.CloudProfileApplicationContextInitializer`, `org.cloudfoundry.reconfiguration.spring.CloudPropertySourceApplicationContextInitializer`, and `org.cloudfoundry.reconfiguration.spring.CloudAutoReconfigurationApplicationContextInitializer` to the collection of `contextInitializerClasses`. The Spring Auto-reconfiguration Framework also adds the `cloud` profile to any existing Spring profiles such as those defined in the [`SPRING_PROFILES_ACTIVE`][] environment variable.
1717

1818
## Configuration
1919
For general information on configuring the buildpack, refer to [Configuration and Extension][].
@@ -31,3 +31,4 @@ The framework can be configured by modifying the [`config/spring_auto_reconfigur
3131
[repositories]: extending-repositories.md
3232
[this listing]: http://download.pivotal.io.s3.amazonaws.com/auto-reconfiguration/index.yml
3333
[version syntax]: extending-repositories.md#version-syntax-and-ordering
34+
[`SPRING_PROFILES_ACTIVE`]: http://docs.spring.io/spring/docs/4.0.0.RELEASE/javadoc-api/org/springframework/core/env/AbstractEnvironment.html#ACTIVE_PROFILES_PROPERTY_NAME

0 commit comments

Comments
 (0)