-
Notifications
You must be signed in to change notification settings - Fork 40.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration properties enabled in a child context are ignored if an ancestor context has already enabled the properties #41487
Comments
Thanks for the report but it does not include enough information for us to be able to help you. If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue. |
Thanks. Here is an example project that reproduces the problem The thing that I noticed in time providing this example is when
meaning our redis didnt get configured, so removing |
Thanks for the sample. You can work around the problem by adding the following @Bean(name = "management.server-org.springframework.boot.actuate.autoconfigure.web.server.ManagementServerProperties")
ManagementServerProperties managementServerProperties() {
return new ManagementServerProperties();
} |
The management server settings in the child context are ignored due to 1061afb which fixed #8187. It's not clear to me what the underlying problem was that motivated #8187. When the properties in the parent and the child are the same, defining the same bean in the child is inefficient but I can't think of a scenario where it may break something. When the properties in the parent and child differ, as they do in the case described in this issue, not defining the bean in the child causes the child's properties to be ignored and for the parent's to be reused. |
We discussed this today and consider it a bug. We're going to try to revert #8187. This is a little risky so we're going to target 3.4.x and suggest the workaround for existing versions. |
Hi,
We have setup a spring boot application with context hierarchy according to this baeldung article. github
Given code was pretty simple but expectation is that we can configure each context
management.server.port
in its own.properties
file. but in action onlymanagement.server.port
is being read only from parent.properties
file. (article doesnt have one but in our app we gave a .properties for parent too). hence when one of contexts e.g. Ctx1 gets started and gets running on port for example 9090 (when we define a separate port for actuator) and management 9095 second context (Ctx2) runs on a separate web port e.g 9091 but management port is being set to 9095 for second context too.Or if we do not set any port in parent
.properties
file we get bellow error:In
ManagementWebServerFactoryCustomizer
we have:managementServerProperties
reads from parent context (in case we didnt set and is null) and actual port is set in.properties
file of child context, applies to serverProperties. here is customizeIn here
factory.setPort
is being set only frommanagementServerProperties
which in this case is null and actual port is set in serverProperties. and we get theerror
The text was updated successfully, but these errors were encountered: