Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run Modulith with AOT #280

Closed
mrudolph1986 opened this issue Aug 24, 2023 · 1 comment
Closed

Unable to run Modulith with AOT #280

mrudolph1986 opened this issue Aug 24, 2023 · 1 comment
Assignees
Labels
in: moments The moment of time abstraction type: bug Something isn't working
Milestone

Comments

@mrudolph1986
Copy link

I am trying to use modulith with AOT for graalvm and it fails to initiate the MomentProperties:

Exception in thread "main" java.lang.IllegalStateException: No constructor or factory method candidate found for Root bean: class [org.springframework.modulith.moments.support.MomentsProperties]; scope=singleton; abstract=false; lazyInit=null; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodNames=null; destroyMethodNames=null and argument types [] at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorOrFactoryMethod(ConstructorResolver.java:947) at org.springframework.beans.factory.support.RegisteredBean.resolveConstructorOrFactoryMethod(RegisteredBean.java:212) at org.springframework.beans.factory.aot.BeanDefinitionMethodGenerator.<init>(BeanDefinitionMethodGenerator.java:86) at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getBeanDefinitionMethodGenerator(BeanDefinitionMethodGeneratorFactory.java:100) at org.springframework.beans.factory.aot.BeanDefinitionMethodGeneratorFactory.getBeanDefinitionMethodGenerator(BeanDefinitionMethodGeneratorFactory.java:115) at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:49) at org.springframework.beans.factory.aot.BeanRegistrationsAotProcessor.processAheadOfTime(BeanRegistrationsAotProcessor.java:37) at org.springframework.context.aot.BeanFactoryInitializationAotContributions.getContributions(BeanFactoryInitializationAotContributions.java:67) at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:49) at org.springframework.context.aot.BeanFactoryInitializationAotContributions.<init>(BeanFactoryInitializationAotContributions.java:44) 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)

If I configure "spring.modulith.moments.enabled: false" it seems to be working, but now I am missing some features.

odrotbohm added a commit that referenced this issue Aug 26, 2023
Introduce a default constructor to prevent the AOT engine from breaking as reported in [0].

[0] spring-projects/spring-framework#31117
odrotbohm added a commit that referenced this issue Aug 26, 2023
Introduce a default constructor to prevent the AOT engine from breaking as reported in [0].

[0] spring-projects/spring-framework#31117
@odrotbohm odrotbohm added this to the 1.0.1 milestone Aug 26, 2023
@odrotbohm odrotbohm self-assigned this Aug 26, 2023
@odrotbohm odrotbohm added in: moments The moment of time abstraction type: bug Something isn't working labels Aug 26, 2023
@odrotbohm
Copy link
Member

I've fixed this by introducing a private default constructor for now. Upstream ticket filed for Spring Framework as it should be able to handle the class without one, too, as it does in the non AOT case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: moments The moment of time abstraction type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants