Java buildpack 4.51 and 4.52 disables Spring Auto Reconfiguration functionality by default. This deprecation may require planning and action taken by developers & operators depending on whether applications utilize these features. A new Java buildpack 4.53 reverts this behavior so that Spring Auto Reconfiguration is no longer disabled by default.
Spring Cloud Connectors is deprecated since 2019 and set to be archived after Dec 2022. Spring Auto Reconfiguration is first deprecated with release of Java Buildpack 4.49.
Spring Cloud DataFlow tile versions 1.12.4 and lower has dependency on auto reconfiguration. Dataflow application will fail to start if running on foundation with upgraded Java buildpack.
Refer to Java buildpack release notes.
Developers of Java Spring applications will need to ensure they are not using Spring Cloud Connectors or Auto Reconfiguration. If they are then it will be necessary to migrate to using java-cfenv
.
Detection:
Java buildpack 4.49+ inspects your applications and WARN
if you are using Spring Cloud Connectors and Spring Auto Reconfiguration. These warning messages will occur at staging.
Spring Cloud Connectors WARN'ing:
[SpringAutoReconfiguration] WARN ATTENTION: The Spring Cloud Connectors library is present in your application. This library has been in maintenance mode since July 2019 and will stop receiving all updates after Dec 2022. [SpringAutoReconfiguration] WARN Please migrate to java-cfenv immediately. See https://via.vmw.com/EhzD for migration instructions.
Spring Auto Reconfiguration WARN'ing:
[SpringAutoReconfiguration] WARN ATTENTION: The Spring Auto Reconfiguration and shaded Spring Cloud Connectors libraries are being installed. These projects have been deprecated, are no longer receiving updates and should not be used going forward. [SpringAutoReconfiguration] WARN If you are not using these libraries, set `JBP_CONFIG_SPRING_AUTO_RECONFIGURATION='{enabled: false}'` to disable their installation and clear this warning message. The buildpack will switch its default to disable by default after Aug 2022. Spring Auto Reconfiguration and its shaded Spring Cloud Connectors will be removed from the buildpack after Dec 2022. [SpringAutoReconfiguration] WARN If you are using these libraries, please migrate to java-cfenv immediately. See https://via.vmw.com/EhzD for migration instructions.
In addition, apps will print the message Reconfiguration enabled
during startup if they're leveraging this deprecated capability. You will see reconfiguration library get loaded at startup, for example:
[ main] o.c.reconfiguration.CloudServiceUtils : 'rabbitConnectionFactory' bean of type with 'org.springframework.amqp.rabbit.connection.ConnectionFactory' reconfigured with 'rabbit-1' bean
Both this message (during startup) and WARN'ings (during staging) are evidence of auto-reconfiguration being in-use.
Application code can also be reviewed for the following dependencies:
org.springframework.boot:spring-boot-starter-cloud-connectors or org.springframework.cloud:spring-cloud-core org.springframework.cloud:spring-cloud-connectors-core org.springframework.cloud:spring-cloud-cloudfoundry-connector org.springframework.cloud:spring-cloud-spring-service-connector
Migration:
Applications need to be migrated to use java-cfenv
for parsing service bindings and auto-configuring services. The CloudFoundry documentation has been updated with usage instructions as well as a migration guide.
Java buildpack will also automatically disable SAR/SCC when you have java-cfenv
present in your application. This make migration easier as the two should not be used together, and it also prevents spurious warnings since the presence of this library means you are in the process of or have already moved to java-cfenv
.
Please be extra cautious when migrating as java-cfenv
does not enable the cloud
profile automatically. When you add this dependency, the buildpack will disable SAR/SCC which also disables the profile. As is documented in the migration guide, you need to manually enable this profile if it's required by your application.
cf set-env <app-name JBP_CONFIG_SPRING_AUTO_RECONFIGURATION '{enabled: true}'Application will require restaging.
If you upgraded and are facing problems due to this deprecation then you have the following options:
1) Work with your developers to migrate their applications to java-cfenv. (following developer guidelines above)
2) If you want to continue using older Java Buildpack after upgrading then this can be done by locking the current Java Buildpack:
cf update-buildpack java_buildpack_offline -p java-buildpack-offline-v4.50.zip --lock
Refer to: locking buildpack guide
3) If you already upgraded and are facing problems due to deprecation, then you can set default Java Buildpack to an older version by changing buildpack priority.
cf update-buildpack java_buildpack_offline -p java-buildpack-offline-v4.50.zip -i 1The "-i 1" is the position order and needs to be set to an integer lower than default java buildpack. (in output of cf buildpacks command)
cf set-staging-environment-variable-group '{"JBP_CONFIG_SPRING_AUTO_RECONFIGURATION ":"{enabled: true}"}'
cf set-env p-dataflow-1.12.4 JBP_CONFIG_SPRING_AUTO_RECONFIGURATION '{enabled: true}'