如何在spring processAot任务中发现错误?



我要将我的应用程序更改为带有原生gral的新的spring启动3.0.5。

执行processAot任务时,出现以下错误:

Task :app:processAot
12:04:29.496 [main] DEBUG reactor.util.Loggers -- Using Slf4j logging framework
2023-04-11 12:04:30.250 INFO  app=security-token-service, traceId=, spanId=, t=background-preinit, class=org.hibernate.validator.internal.util.Version, HV000001: Hibernate Validator 8.0.0.Final 
.   ____          _            __ _ _
/\ / ___'_ __ _ _(_)_ __  __ _    
( ( )___ | '_ | '_| | '_ / _` |    
\/  ___)| |_)| | | | | || (_| |  ) ) ) )
'  |____| .__|_| |_|_| |___, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot ::                (v3.0.5)
2023-04-11 12:04:30.335 INFO  app=security-token-service, traceId=, spanId=, t=main, class=s.token.service.SecurityTokenServiceApplicationKt, Starting SecurityTokenServiceApplicationKt using Java 17.0.6 with PID 71943 (/Users/rgfirmino/workspace/security-token-service/app/build/classes/kotlin/main started by rgfirmino in /Users/rgfirmino/workspace/security-token-service/app) 
2023-04-11 12:04:30.337 INFO  app=security-token-service, traceId=, spanId=, t=main, class=s.token.service.SecurityTokenServiceApplicationKt, No active profile set, falling back to 1 default profile: "default" 
Exception in thread "main" java.lang.IllegalArgumentException: invalid type parameter: void
at org.springframework.javapoet.Util.checkArgument(Util.java:53)
at org.springframework.javapoet.ParameterizedTypeName.<init>(ParameterizedTypeName.java:51)
at org.springframework.javapoet.ParameterizedTypeName.<init>(ParameterizedTypeName.java:38)
at org.springframework.javapoet.ParameterizedTypeName.get(ParameterizedTypeName.java:119)
at org.springframework.beans.factory.aot.InstanceSupplierCodeGenerator.buildGetInstanceMethodForFactoryMethod(InstanceSupplierCodeGenerator.java:257)
at org.springframework.beans.factory.aot.InstanceSupplierCodeGenerator.lambda$generateCodeForAccessibleFactoryMethod$2(InstanceSupplierCodeGenerator.java:228)
at org.springframework.aot.generate.GeneratedMethod.<init>(GeneratedMethod.java:54)
at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:112)
at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:89)
at org.springframework.beans.factory.aot.InstanceSupplierCodeGenerator.generateGetInstanceSupplierMethod(InstanceSupplierCodeGenerator.java:331)
at org.springframework.beans.factory.aot.InstanceSupplierCodeGenerator.generateCodeForAccessibleFactoryMethod(InstanceSupplierCodeGenerator.java:227)
at org.springframework.beans.factory.aot.InstanceSupplierCodeGenerator.generateCodeForFactoryMethod(InstanceSupplierCodeGenerator.java:206)
at org.springframework.beans.factory.aot.InstanceSupplierCodeGenerator.generateCode(InstanceSupplierCodeGenerator.java:98)
at org.springframework.beans.factory.aot.DefaultBeanRegistrationCodeFragments.generateInstanceSupplierCode(DefaultBeanRegistrationCodeFragments.java:206)
at org.springframework.beans.factory.aot.BeanRegistrationCodeGenerator.generateCode(BeanRegistrationCodeGenerator.java:89)
at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.lambda$generateBeanDefinitionMethod$3(BeanDefinitionMethodGenerator.java:194)
at org.springframework.aot.generate.GeneratedMethod.<init>(GeneratedMethod.java:54)
at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:112)
at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:89)
at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:188)
at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.generateBeanDefinitionMethod(BeanDefinitionMethodGenerator.java:109)
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$generateRegisterBeanDefinitionsMethod$2(BeanRegistrationsAotContribution.java:85)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.generateRegisterBeanDefinitionsMethod(BeanRegistrationsAotContribution.java:83)
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.lambda$applyTo$1(BeanRegistrationsAotContribution.java:67)
at org.springframework.aot.generate.GeneratedMethod.<init>(GeneratedMethod.java:54)
at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:112)
at org.springframework.aot.generate.GeneratedMethods.add(GeneratedMethods.java:89)
at org.springframework.beans.factory.aot.BeanRegistrationsAotContribution.applyTo(BeanRegistrationsAotContribution.java:66)
at org.springframework.context.aot.BeanFactoryInitializationAotContributions.applyTo(BeanFactoryInitializationAotContributions.java:78)
at org.springframework.context.aot.ApplicationContextAotGenerator.lambda$processAheadOfTime$0(ApplicationContextAotGenerator.java:58)
at org.springframework.context.aot.ApplicationContextAotGenerator.withCglibClassHandler(ApplicationContextAotGenerator.java:67)
at org.springframework.context.aot.ApplicationContextAotGenerator.processAheadOfTime(ApplicationContextAotGenerator.java:53)
at org.springframework.context.aot.ContextAotProcessor.performAotProcessing(ContextAotProcessor.java:106)
at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:84)
at org.springframework.context.aot.ContextAotProcessor.doProcess(ContextAotProcessor.java:49)
at org.springframework.context.aot.AbstractAotProcessor.process(AbstractAotProcessor.java:82)
at org.springframework.boot.SpringApplicationAotProcessor.main(SpringApplicationAotProcessor.java:80)
> Task :app:processAot FAILED

即使使用——stacktrace或——debug,错误信息仍然是相同的。我已经删除了所有的VOID方法,但是没有成功。我不知道错误指的是哪个方法。

有没有人知道我怎样才能使错误更具体?

  • 更新大量依赖项

  • 不是有效

  • REMOVE很多依赖项

  • 不是有效

  • 使用的堆栈跟踪和调试定义

  • 不是有效

我仍然没有弄清楚如何使AOT错误消息更具体,但我发现了我的问题。如果有人需要它,AOT不理解带有VOID返回的spring bean。

我有一个@Bean,它没有返回任何东西:

@Configuration
class BouncyCastleConfig {
@Bean
fun addProviders() {
Security.addProvider(BouncyCastleProvider())
}
}

我切换到静态的东西:

@Configuration
class BouncyCastleConfig {
init {
Security.addProvider(BouncyCastleProvider())
}
}

最新更新