Pivotal Knowledge Base

Follow

Why .profile.d does not work with Spring boot 1.4

Environment 

Product Version
Spring Boot 1.4
Java buildpack  3.8.1 and later

Overview 

This article discusses why .profile.d does not work with Spring boot 1.4.

Background

Prior to Spring boot 1.4, .profile.d script is packaged at the root directory of your WAR or JAR file. To check you can run jar tf <jar-or-war-file>. When you upgrade to Spring Boot 1.4, .profile.d scripts are no longer packaged at the root directory of your WAR or JAR file. Instead it is placed under BOOT-INF/classes.  

Resolution

 Editing .profile.d script is not encouraged unless you are using custom buildpack. Here are reasons why:

  • Because these hooks have the ability to change the environment of a running application, they can also invalidate assumptions that the buildpack makes about the environment. Therefore, if you choose to use them, any strange behavior in the buildpack or at runtime is your responsibility.
  • The actual functionality of executing these hooks is owned by the container, not the buildpacks so they will get executed no matter what. That being said, it is strongly discourage the use of these hooks as they encourage including environment-specific functionality within an application, violating one of the major tenants of 12-Factor applications. For example, using the .profile support means that your application may no longer runs the same way locally during development as it does inside of the CF container. 

In case you really need to include .profile.d script, please create your own custom buildpack. For more info on creating a custom buildpack, please click here.

Related Article

How to initialize the application container environment with .profile.d script

 

Comments

Powered by Zendesk