Closed kleino closed 1 year ago
The main problem here is using records as a DTO.
Method getName() cannot be found on type com.example.demo.SomeDto
You have to add some reflection hints to include all public methods from your DTO into the native image. Then Thmyeleaf with records should work.
I'll reword the issue and add it to the backlog.
For this kind of use case, we don't have explicit trigger from the annotation based programming model, so 2 potential solutions that I am mentioning here more for discussion related to our upcoming Spring Boot 3 support:
model.addAttribute
via #1152Spring Native is now superseded by Spring Boot 3 official native support, see the related reference documentation for more details.
As a consequence, I am closing this issue, and recommend trying your use case with latest Spring Boot 3 version. If you still experience the issue reported here, please open an issue directly on the related Spring project (Spring Framework, Data, Security, Boot, Cloud, etc.) with a reproducer.
Thanks for your contribution on the experimental Spring Native project, we hope you will enjoy the official native support introduced by Spring Boot 3.
Hi, I have an issue acessing dtos/records in a thymeleaf-template when using a docker image generated via spring-native. It works perfectly fine if
BP_NATIVE_IMAGE = false
Controller
When opening the page, this results in following exception:
Minimum viable demo: demo.zip
OS: Kernel: 5.10.124-1-MANJARO x86_64 'org.springframework.boot' version '2.7.0' 'org.springframework.experimental.aot' version '0.12.0' java: 17.0.3-tem gradle: 7.4.1
Could you please provide some support here, on what I'm might missing here?
Thanks!