The Spring Auto Reconfiguration Framework causes an application to be automatically reconfigured to work with configured cloud services.
Detection Criterion | Existence of a spring-core*.jar file in the application directory |
Tags | spring-auto-reconfiguration-<version> |
If the /WEB-INF/web.xml
file exists, the framework will modify it in addition to making the auto reconfiguration JAR available on the classpath. These modifications include:
- Augmenting
contextConfigLocation
- The function starts by enumerating the current
contextConfigLocation
s. If none exist, a default configuration is created with/WEB-INF/application-context.xml
or/WEB-INF/<servlet-name>-servlet.xml
as the default. - An additional location is then added to the collection of locations:
- If the
ApplicationContext
is XML-basedclasspath:META- INF/cloud/cloudfoundry-auto-reconfiguration-context.xml
- If the
ApplicationContext
is annotation-basedorg.cloudfoundry.reconfiguration.spring.web.CloudAppAnnotationConfigAutoReconfig
- If the
- The function starts by enumerating the current
- Augmenting
contextInitializerClasses
- The function starts by enumerating the current
contextInitializerClasses
. If none exist, a default configuration is created with no value as the default. - The
org.cloudfoundry.reconfiguration.spring.CloudApplicationContextInitializer
class is then added to the collection of classes.
- The function starts by enumerating the current
For general information on configuring the Buildpack, refer to Configuration and Extension.
To configure the framework, you can modify the config/springautoreconfiguration.yml
file. The framework uses the Repository
utility support and it supports the version syntax.
Name | Description |
---|---|
enabled |
Whether to attempt auto-reconfiguration. |
repository_root |
The URL of the Auto Reconfiguration repository index (details). |
version |
The version of Auto Reconfiguration to use. You can find the candidate versions here. |
The Spring Auto Reconfiguration framework configuration can be overridden with the JBP_CONFIG_SPRINGAUTORECONFIGURATION
environment variable. The value of the variable should be valid inline YAML. For example:
-
Disable the framework:
$ cf set-env myApplication JBP_CONFIG_SPRINGAUTORECONFIGURATION 'enabled: false'
The environment variables can also be specified in the manifest.yml file.