Skip to content
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

Hints required for @Bean + @ConfigurationProperties Kotlin (probably not only) classes #33849

Closed
Azbesciak opened this issue Jan 17, 2023 · 7 comments
Labels
status: superseded An issue that has been superseded by another type: bug A general bug

Comments

@Azbesciak
Copy link

Hello, this is a continuation from #33509.
The same example repo may be used, please see https://github.com/Azbesciak/spring-3-configuration-prop-issue with branch config-prop-bean and changed the spring boot version to 3.0.2-SNAPSHOT.

The problem is that regarding https://docs.spring.io/spring-boot/docs/current/reference/html/native-image.html#native-image.advanced every @ConfigurationProperties (at least I understand it like this) should be managed by the native image, hints are no required, etc.

Whereas it is unfortunately not true - when I generate the native image, it fails in the runtime with the following exception:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'myServiceC': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'someBean': Runtime reflection is not supported for public void com.example.demo.SomeBean.setCustomValue(java.lang.String)
[...]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'someBean': Runtime reflection is not supported for public void com.example.demo.SomeBean.setCustomValue(java.lang.String)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 17, 2023
@wilkinsona
Copy link
Member

It looks like reflection metadata is being generated for constructor binding but setter-based binding is being used at runtime. That feels like a bug.

@Azbesciak
Copy link
Author

Since this is a regression, do you have any view on fixing that? Cannot upgrade my dependencies without much changes, maybe at least some migration then?

@wilkinsona
Copy link
Member

Why do you believe it's a regression? With what version does it work?

@Azbesciak
Copy link
Author

@wilkinsona it worked for the last 4 years.

@wilkinsona
Copy link
Member

Your problem appears to be specific to GraalVM and native images, support for which was added in 3.0 which was released in late 2022. How has it worked for the last 4 years?

@Azbesciak
Copy link
Author

Yes, sorry, I am multithreading. I was thinking about the problem with @ConfigurationProperties and bean related annotation, mentioned in
#33509 (comment).

Sorry, I did not read the title before I responded.
Yes, for that case it cannot be for the last 4 years, for sure, since there was no native support for spring.

@wilkinsona
Copy link
Member

With Spring Boot 3.0.9 the problem on longer occurs.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Jul 21, 2023
@wilkinsona wilkinsona removed this from the 3.0.x milestone Jul 21, 2023
@wilkinsona wilkinsona added the status: superseded An issue that has been superseded by another label Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants