Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

@ConfigurationProperties with @Validated on a record - native build still fails even in 0.11.3 #1522

Closed
prettymama opened this issue Mar 4, 2022 · 5 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@prettymama
Copy link

Basically a continuation of #1462, the native build still crashes when @ConfigurationProperties and @Validated annotations are placed on a record. Problem is still with proxy creation, the exception is however different than in <0.11.3

2022-03-04 09:44:12.671  INFO 89 --- [           main] o.s.n.s.SpringAnalyzer                   : Spring Native operating mode: native
2022-03-04 09:45:06.157  INFO 89 --- [           main] o.s.a.f.ProxyGenerator                   : Generating class file bytes for a proxy named xxx.ServerConfiguration$$SpringProxy$6571616c
java.lang.IllegalStateException: Cannot create a build time proxy for a final class: xxx.ServerConfiguration
        at org.springframework.aop.framework.ProxyGenerator.getProxyBytes(ProxyGenerator.java:73)
        at org.springframework.aot.nativex.ConfigurationContributor.generateBuildTimeClassProxy(ConfigurationContributor.java:193)
        at org.springframework.aot.nativex.ConfigurationContributor.generateBuildTimeClassProxies(ConfigurationContributor.java:170)
        at org.springframework.aot.nativex.ConfigurationContributor.processBuildTimeClassProxyRequests(ConfigurationContributor.java:142)
        at org.springframework.aot.nativex.ConfigurationContributor.contribute(ConfigurationContributor.java:74)
        at org.springframework.aot.build.BootstrapCodeGenerator.generate(BootstrapCodeGenerator.java:91)
        at org.springframework.aot.build.BootstrapCodeGenerator.generate(BootstrapCodeGenerator.java:71)
        at org.springframework.aot.build.GenerateBootstrapCommand.call(GenerateBootstrapCommand.java:107)
        at org.springframework.aot.build.GenerateBootstrapCommand.call(GenerateBootstrapCommand.java:42)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at org.springframework.aot.build.GenerateBootstrapCommand.main(GenerateBootstrapCommand.java:112)
java.lang.IllegalStateException: Problem creating proxy with configuration: org.springframework.aop.framework.ProxyConfiguration@6571616c
        at org.springframework.aop.framework.ProxyGenerator.getProxyBytes(ProxyGenerator.java:98)
        at org.springframework.aot.nativex.ConfigurationContributor.generateBuildTimeClassProxy(ConfigurationContributor.java:193)
        at org.springframework.aot.nativex.ConfigurationContributor.generateBuildTimeClassProxies(ConfigurationContributor.java:170)
        at org.springframework.aot.nativex.ConfigurationContributor.processBuildTimeClassProxyRequests(ConfigurationContributor.java:142)
        at org.springframework.aot.nativex.ConfigurationContributor.contribute(ConfigurationContributor.java:74)
        at org.springframework.aot.build.BootstrapCodeGenerator.generate(BootstrapCodeGenerator.java:91)
        at org.springframework.aot.build.BootstrapCodeGenerator.generate(BootstrapCodeGenerator.java:71)
        at org.springframework.aot.build.GenerateBootstrapCommand.call(GenerateBootstrapCommand.java:107)
        at org.springframework.aot.build.GenerateBootstrapCommand.call(GenerateBootstrapCommand.java:42)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at org.springframework.aot.build.GenerateBootstrapCommand.main(GenerateBootstrapCommand.java:112)
Caused by: java.lang.IllegalStateException: Cannot create a build time proxy for a final class: xxx.ServerConfiguration
        at org.springframework.aop.framework.ProxyGenerator.getProxyBytes(ProxyGenerator.java:73)
        ... 16 more

Nested record detection problem mentioned in #1462 has gone.

Spring Boot: 2.6.4
Spring Native: 0.11.3
GraalVM: 22.0.0.2 CE

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 4, 2022
@sdeleuze
Copy link
Contributor

sdeleuze commented Mar 7, 2022

Please share a repro project.

@sdeleuze sdeleuze added the status: waiting-for-feedback We need additional information before we can continue label Mar 7, 2022
@prettymama
Copy link
Author

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 7, 2022
@sdeleuze sdeleuze added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Mar 7, 2022
@sdeleuze sdeleuze added this to the 0.11.4 milestone Mar 7, 2022
@sdeleuze
Copy link
Contributor

sdeleuze commented Mar 7, 2022

@aclement Seems to be related to #969, could you please have a look to this one?

@aclement
Copy link
Contributor

aclement commented Apr 1, 2022

With the changes in that commit the sample project compiles fine (thanks for that) and starts.
I have not, however, added test cases around whether validation actually works in a native-image with record types, but at least the image builds now.

@sdeleuze
Copy link
Contributor

sdeleuze commented Apr 5, 2022

Thanks Andy.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A general bug
Development

No branches or pull requests

4 participants