Skip to content

Commit 1703374

Browse files
committed
Merge 72265294-auto-reconfig-kill-switch to master
[Completes #72265294]
2 parents 25ce0a3 + 2dc2748 commit 1703374

12 files changed

+54
-15
lines changed

config/play_framework_auto_reconfiguration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
---
2020
version: 1.+
2121
repository_root: "{default.repository.root}/auto-reconfiguration"
22+
enabled: true

config/play_framework_jpa_plugin.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@
1717
---
1818
version: 1.+
1919
repository_root: "{default.repository.root}/play-jpa-plugin"
20+
enabled: true

config/spring_auto_reconfiguration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
---
2020
version: 1.+
2121
repository_root: "{default.repository.root}/auto-reconfiguration"
22+
enabled: true

docs/framework-play_framework_auto_reconfiguration.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Play Framework Auto Reconfiguration Framework
2-
The Play Framework Auto Reconfiguration Framework causes an application to be automatically reconfigured to work with configured cloud services.
1+
# Play Framework Auto-reconfiguration Framework
2+
The Play Framework Auto-reconfiguration Framework causes an application to be automatically reconfigured to work with configured cloud services.
33

44
<table>
55
<tr>
@@ -21,8 +21,9 @@ The framework can be configured by modifying the [`config/play_framework_auto_re
2121

2222
| Name | Description
2323
| ---- | -----------
24-
| `repository_root` | The URL of the Auto Reconfiguration repository index ([details][repositories]).
25-
| `version` | The version of Auto Reconfiguration to use. Candidate versions can be found in [this listing][].
24+
| `repository_root` | The URL of the Auto-reconfiguration repository index ([details][repositories]).
25+
| `version` | The version of Auto-reconfiguration to use. Candidate versions can be found in [this listing][].
26+
| `enabled` | Whether to attempt auto-reconfiguration
2627

2728
[Configuration and Extension]: ../README.md#configuration-and-extension
2829
[`config/play_framework_auto_reconfiguration.yml`]: ../config/config/play_framework_auto_reconfiguration.yml

docs/framework-play_framework_jpa_plugin.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ The framework can be configured by modifying the [`config/play_framework_jpa_plu
2727
| ---- | -----------
2828
| `repository_root` | The URL of the Play Framework JPA Plugin repository index ([details][repositories]).
2929
| `version` | The version of the Play Framework JPA Plugin to use. Candidate versions can be found in [this listing][].
30+
| `enabled` | Whether to attempt reconfiguration
3031

3132
[Configuration and Extension]: ../README.md#configuration-and-extension
3233
[`config/play_framework_jpa_plugin.yml`]: ../config/play_framework_jpa_plugin.yml

docs/framework-spring_auto_reconfiguration.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Spring Auto Reconfiguration Framework
2-
The Spring Auto Reconfiguration Framework causes an application to be automatically reconfigured to work with configured cloud services.
1+
# Spring Auto-reconfiguration Framework
2+
The Spring Auto-reconfiguration Framework causes an application to be automatically reconfigured to work with configured cloud services.
33

44
<table>
55
<tr>
@@ -13,10 +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. These modifications include:
17-
18-
1. Augmenting `contextConfigLocation`. The function starts be 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; `classpath:META- INF/cloud/cloudfoundry-auto-reconfiguration-context.xml` if the `ApplicationContext` is XML-based, `org.cloudfoundry.reconfiguration.spring.web.CloudAppAnnotationConfigAutoReconfig` if the `ApplicationContext` is annotation-based.
19-
1. 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.
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`.
2017

2118
## Configuration
2219
For general information on configuring the buildpack, refer to [Configuration and Extension][].
@@ -25,8 +22,9 @@ The framework can be configured by modifying the [`config/spring_auto_reconfigur
2522

2623
| Name | Description
2724
| ---- | -----------
28-
| `repository_root` | The URL of the Auto Reconfiguration repository index ([details][repositories]).
29-
| `version` | The version of Auto Reconfiguration to use. Candidate versions can be found in [this listing][].
25+
| `repository_root` | The URL of the Auto-reconfiguration repository index ([details][repositories]).
26+
| `version` | The version of Auto-reconfiguration to use. Candidate versions can be found in [this listing][].
27+
| `enabled` | Whether to attempt auto-reconfiguration
3028

3129
[Configuration and Extension]: ../README.md#configuration-and-extension
3230
[`config/spring_auto_reconfiguration.yml`]: ../config/spring_auto_reconfiguration.yml

lib/java_buildpack/framework/play_framework_auto_reconfiguration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def release
4141

4242
# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?)
4343
def supports?
44-
JavaBuildpack::Util::Play::Factory.create @droplet
44+
@configuration['enabled'] && JavaBuildpack::Util::Play::Factory.create(@droplet)
4545
end
4646

4747
end

lib/java_buildpack/framework/play_framework_jpa_plugin.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def supports?
4747
play_app = JavaBuildpack::Util::Play::Factory.create @droplet
4848
candidate = uses_jpa?(play_app) || play20?(play_app.version) if play_app
4949

50-
candidate
50+
@configuration['enabled'] && candidate
5151
end
5252

5353
private

lib/java_buildpack/framework/spring_auto_reconfiguration.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def release
5151

5252
# (see JavaBuildpack::Component::VersionedDependencyComponent#supports?)
5353
def supports?
54-
(@droplet.root + '**/*spring-core*.jar').glob.any?
54+
@configuration['enabled'] && (@droplet.root + '**/*spring-core*.jar').glob.any?
5555
end
5656

5757
private

spec/java_buildpack/framework/play_framework_auto_reconfiguration_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
describe JavaBuildpack::Framework::PlayFrameworkAutoReconfiguration do
2222
include_context 'component_helper'
2323

24+
let(:configuration) { { 'enabled' => true } }
25+
2426
it 'should detect with application configuration',
2527
app_fixture: 'container_play_2.1_dist' do
2628

@@ -33,6 +35,16 @@
3335
expect(component.detect).to be_nil
3436
end
3537

38+
context do
39+
let(:configuration) { { 'enabled' => false } }
40+
41+
it 'should not detect if disabled',
42+
app_fixture: 'container_play_2.1_dist' do
43+
44+
expect(component.detect).to be_nil
45+
end
46+
end
47+
3648
it 'should download additional libraries',
3749
app_fixture: 'container_play_2.1_dist',
3850
cache_fixture: 'stub-auto-reconfiguration.jar' do

0 commit comments

Comments
 (0)