spring-cloud/spring-cloud-deployer-cloudfoundry

Auto Configure manifest for Spring boot apps with `java-cfenv` dependencies

dturanski opened this issue · 0 comments

Depends on #343 . Spring Boot apps deployed to CloudFoundry that are autoconfigured with java-cfenv must set environment variables in the manifest. Otherwise cfenv will throw an exception:

JBP_CONFIG_SPRING_AUTO_RECONFIGURATION='{enabled:false}
SPRING_PROFILES_ACTIVE=cloud

It is possible to use Spring Boot JarFileArchive along with URLClassLoader to inspect the boot jar and determine if it contains CfEnv.class . If it's there, we add the required configuration automatically.

The limitation is that this will only work for boot apps. In theory it's possible to do something similar for docker images, but would require a docker daemon accessible to the deployer host/container. So does not seem practical. Obviously, this will not work the same for non-boot jars. But it should cover the vast majority of cases, including the Fahrenheit release of Spring supported stream applications.