`repeated interface: org.springframework.aop.SpringProxy` with spring-security annotations on `@RestController`
See original GitHub issueI get following error as soon as I use both @RequiredArgsConstructor
and @PreAuthorize
in the same a @RestController
:
[INFO] [creator] Error: Error parsing dynamic proxy configuration in file:/workspace/META-INF/native-image/org.springframework.aot/spring-aot/proxy-config.json:
[INFO] [creator] java.lang.IllegalArgumentException: repeated interface: org.springframework.aop.SpringProxy
[INFO] [creator] Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option DynamicProxyConfigurationResources.
[INFO] [creator] com.oracle.svm.core.util.UserError$UserException: Error parsing dynamic proxy configuration in file:/workspace/META-INF/native-image/org.springframework.aot/spring-aot/proxy-config.json:
[INFO] [creator] java.lang.IllegalArgumentException: repeated interface: org.springframework.aop.SpringProxy
[INFO] [creator] Verify that the configuration matches the schema described in the -H:PrintFlags=+ output for option DynamicProxyConfigurationResources.
[INFO] [creator] at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
[INFO] [creator] at com.oracle.svm.hosted.config.ConfigurationParserUtils.doParseAndRegister(ConfigurationParserUtils.java:139)
[INFO] [creator] at com.oracle.svm.hosted.config.ConfigurationParserUtils.lambda$parseAndRegisterConfigurations$3(ConfigurationParserUtils.java:120)
[INFO] [creator] at java.base/java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:212)
[INFO] [creator] at com.oracle.svm.hosted.config.ConfigurationParserUtils$1.tryAdvance(ConfigurationParserUtils.java:109)
[INFO] [creator] at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:326)
[INFO] [creator] at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
[INFO] [creator] at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:274)
[INFO] [creator] at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
[INFO] [creator] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
[INFO] [creator] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
[INFO] [creator] at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:312)
[INFO] [creator] at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
[INFO] [creator] at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
[INFO] [creator] at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
[INFO] [creator] at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
[INFO] [creator] at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[INFO] [creator] at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:491)
[INFO] [creator] at java.base/java.util.stream.IntPipeline.sum(IntPipeline.java:449)
[INFO] [creator] at com.oracle.svm.hosted.config.ConfigurationParserUtils.parseAndRegisterConfigurations(ConfigurationParserUtils.java:126)
[INFO] [creator] at com.oracle.svm.reflect.proxy.hosted.DynamicProxyFeature.duringSetup(DynamicProxyFeature.java:80)
[INFO] [creator] at com.oracle.svm.hosted.NativeImageGenerator.lambda$setupNativeImage$18(NativeImageGenerator.java:915)
[INFO] [creator] at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:71)
[INFO] [creator] at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:915)
[INFO] [creator] at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:580)
[INFO] [creator] at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$2(NativeImageGenerator.java:495)
[INFO] [creator] at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
[INFO] [creator] at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[INFO] [creator] at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
[INFO] [creator] at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
[INFO] [creator] at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
[INFO] [creator] at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
[INFO] [creator] Error: Image build request failed with exit status 1
[INFO] [creator] unable to invoke layer creator
[INFO] [creator] unable to contribute native-image layer
[INFO] [creator] error running build
[INFO] [creator] exit status 1
[INFO] [creator] ERROR: failed to build: exit status 1
This can be reproduced starting from security-method-webflux
sample and running mvn spring-boot:build-image
. A PR reproducing the error follows.
Issue Analytics
- State:
- Created 2 years ago
- Comments:34 (17 by maintainers)
Top Results From Across the Web
Interface Driven Controllers in Spring - Baeldung
Learn how to create controllers using Spring MVC request annotation on Java interfaces.
Read more >Spring Boot Reference Documentation
Spring Boot dependencies use the org.springframework.boot groupId . ... The @RestController and @RequestMapping annotations are Spring MVC annotations (they ...
Read more >Spring boot RestController won't work with classes which ...
I tried this with a class which does not implement any interface and that works fine. Here is the code package com.my.service; import...
Read more >Core Spring 4.2 Certification Mock Exam | Java & Moi
The method annotated with @PostConstruct is called after bean instantiation and before properties setting of the bean.
Read more >Go Native with Spring Boot and GraalVM - InfoQ
For Spring Framework 5.x & Spring Boot 2.x, Spring Native is the way to go. ... Test; import org.springframework.beans.factory.annotation.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The ordering of the interfaces being important is actually a Java thing, from https://docs.oracle.com/javase/7/docs/technotes/guides/reflection/proxy.html
@arielcarrera with your latest commit, my project builds valid docker native-images on Windows without any additional
proxy-config.json
file (as it was already doing on Linux).Thanks.