Issue 1267 fix: jbp config java main#1268
Open
stokpop wants to merge 5 commits into
Open
Conversation
…ring Boot
The registry stopped at Spring Boot (highest priority) without ever calling
JavaMainContainer.Detect(). If java_main_class is set in JBP_CONFIG_JAVA_MAIN,
select Java Main unconditionally before the normal detection loop, so it can
override higher-priority containers such as Spring Boot.
Also adds Ruby parity for SERVER_PORT: when java_main_class is a Spring Boot
launcher (JarLauncher, PropertiesLauncher, WarLauncher), write SERVER_PORT=$PORT
to profile.d so the app binds to the CF-assigned port.
Example use case:
JBP_CONFIG_JAVA_MAIN: '{java_main_class: "org.springframework.boot.loader.launch.PropertiesLauncher", arguments: "--loader.home=/home/vcap/data"}'
Updates container-java_main.md: references JBP_CONFIG_JAVA_MAIN instead of
config/java_main.yml, corrects SERVER_PORT behaviour, adds example.
kiril-keranov
approved these changes
May 18, 2026
Contributor
kiril-keranov
left a comment
There was a problem hiding this comment.
looks good, left minor suggestion for possible optimization
| func (r *Registry) Detect() (Container, string, error) { | ||
| cfg := loadJavaMainConfig(r.context.Log) | ||
| if cfg.JavaMainClass != "" { | ||
| for _, container := range r.containers { |
Contributor
There was a problem hiding this comment.
seems this loop might be omit if we rely on the current order that the java main container is with least priority like currently here. If for some reason these container priorities change or a new container is introduced after the java main there will be failing tests like selects Java Main container instead of Spring Boot signaling this to change, also seems no major container priorities reordering or addition of new containers are expected I guess
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also added some notes on why the integration test did not find the missing arguments and command line changes.
Fixes #1267