1

我正在尝试在 Maven多模块项目中为 spring-boot 应用程序构建本机映像。

一旦我用 装饰 @Controller 方法@PreAuthorize,本机图像生成就会失败,并显示以下消息。

在 spring-native 示例之后,我在应用程序类上尝试了使用(如在 中完成security-method-class-proxies)和不使用(如在 中完成security-method@AotProxyHint,但这没有任何区别。

错误:

[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]     Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
[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

任何线索为什么?

4

1 回答 1

0

我想出了关于这个错误的两件事:

  1. 一旦以@PreAuthorize类成员(不是接口)为目标,配置就必须@AotProxyHint(targetClass = ..., proxyFeatures = ProxyBits.IS_STATIC)为此类提供
  2. Windows 上有关于spring-native 问题中声明的错误
于 2021-08-20T19:39:20.887 回答