1

I want to try SpringNative. I have a custom Bean, but when I run "spring-aot:generate" or "spring-boot:build-image", I get the following exception. I don't know how to configure and add Hint Key exception information is as follows

org.springframework.aot.context.bootstrap.generator.BeanDefinitionGenerationException: Failed to handle bean with name 'devInfoHeaderFilter' and type 'tablo.jhin.application.filters.DevInfoHeaderFilter'  at org.springframework.aot.context.bootstrap.generator.ApplicationContextAotProcessor.writeBeanDefinitions
...
Caused by: java.lang.IllegalStateException: Multiple privileged packages: [tablo.jhin.config, tablo.jhin.application.filters]at org.springframework.aot.context.bootstrap.generator.infrastructure.ProtectedAccessAnalysis.getPrivilegedPackageName
...
[ERROR] 
org.apache.maven.plugin.MojoExecutionException: Could not exec java
    at org.springframework.aot.maven.AbstractBootstrapMojo.forkJvm (AbstractBootstrapMojo.java:197)
...
Caused by: org.apache.maven.plugin.MojoExecutionException: Bootstrap code generator finished with exit code: 1
    at org.springframework.aot.maven.AbstractBootstrapMojo.forkJvm (AbstractBootstrapMojo.java:190)
    at org.springframework.aot.maven.GenerateMojo.execute (GenerateMojo.java:132)
....

In a internal class under the 'tablo.jhin.config', I configured such a Bean: ServiceTraceFilterConfiguration as an internal class

    @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
    static class ServletTraceFilterConfiguration implements NativeConfiguration {
        @Bean
        public DevInfoHeaderFilter devInfoHeaderFilter() {
            return new DevInfoHeaderFilter();
        }
}
Tablo_Jhin
  • 301
  • 1
  • 3
  • 10

0 Answers0