You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a bean annotated with @ConfigurationProperties with a prefix. If the java class of the bean is declared in the same maven module the class contains the values from the configuration as expected (in this case with the values from the application.yml file). On the contrary, if the declared class is from another maven module the bean does not have the values from the configuration.
Here it is a snippet to better illustrate the structure:
In the sample project I tried to declare the same class structure in the same and in a separate maven module. Both classes are used by beans declared in the same @configuration class and they load from the same configuration prefix. What happens is that the bean associated with the "internal" class does have the values from the configuration, while the bean from the "external" class does not.
Thanks!
The text was updated successfully, but these errors were encountered:
As noted in this section of the documentation, for constructor binding to work the code must be compiled with -parameters. Your service module is using spring-boot-starter-parent so it inherits the necessary compiler configuration. Your library module is not using spring-boot-starter-parent so it needs to configure the compiler itself. One way to do so is by using the maven.compiler.parameters property:
Spring boot: 3.4.5
Java: 21 (tested on 17 too)
Sample: https://github.com/davgia/demo-service
Original issue: spring-cloud/spring-cloud-kubernetes#1915
I have a bean annotated with @ConfigurationProperties with a prefix. If the java class of the bean is declared in the same maven module the class contains the values from the configuration as expected (in this case with the values from the application.yml file). On the contrary, if the declared class is from another maven module the bean does not have the values from the configuration.
Here it is a snippet to better illustrate the structure:
In the sample project I tried to declare the same class structure in the same and in a separate maven module. Both classes are used by beans declared in the same @configuration class and they load from the same configuration prefix. What happens is that the bean associated with the "internal" class does have the values from the configuration, while the bean from the "external" class does not.
Thanks!
The text was updated successfully, but these errors were encountered: