When running the native-image from the spring-native sample scheduling-tasks
on the sb-3.0.x
branch, i get the following exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schedulingTasksApplication': Invalid declaration of container type [org.springframework.scheduling.annotation.Schedules] for repeatable annotation [org.springframework.scheduling.annotation.Scheduled]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:611) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:526) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:930) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:926) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:592) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:735) ~[scheduling-tasks:3.0.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:431) ~[scheduling-tasks:3.0.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:310) ~[scheduling-tasks:3.0.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1307) ~[scheduling-tasks:3.0.0-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1296) ~[scheduling-tasks:3.0.0-SNAPSHOT]
at com.example.schedulingtasks.SchedulingTasksApplication.main(SchedulingTasksApplication.java:13) ~[scheduling-tasks:0.0.1-SNAPSHOT]
Caused by: org.springframework.core.annotation.AnnotationConfigurationException: Invalid declaration of container type [org.springframework.scheduling.annotation.Schedules] for repeatable annotation [org.springframework.scheduling.annotation.Scheduled]
at org.springframework.core.annotation.RepeatableContainers$ExplicitRepeatableContainer.<init>(RepeatableContainers.java:219) ~[na:na]
at org.springframework.core.annotation.RepeatableContainers.of(RepeatableContainers.java:117) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.core.annotation.AnnotatedElementUtils.getRepeatableAnnotations(AnnotatedElementUtils.java:759) ~[na:na]
at org.springframework.core.annotation.AnnotatedElementUtils.getMergedRepeatableAnnotations(AnnotatedElementUtils.java:455) ~[na:na]
at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.lambda$postProcessAfterInitialization$0(ScheduledAnnotationBeanPostProcessor.java:366) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.core.MethodIntrospector.lambda$selectMethods$0(MethodIntrospector.java:74) ~[na:na]
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:366) ~[na:na]
at org.springframework.core.MethodIntrospector.selectMethods(MethodIntrospector.java:72) ~[na:na]
at org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.postProcessAfterInitialization(ScheduledAnnotationBeanPostProcessor.java:364) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:440) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1755) ~[scheduling-tasks:6.0.0-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:604) ~[scheduling-tasks:6.0.0-SNAPSHOT]
... 14 common frames omitted
Caused by: java.lang.NoSuchMethodException: No value method found
at org.springframework.core.annotation.RepeatableContainers$ExplicitRepeatableContainer.<init>(RepeatableContainers.java:203) ~[na:na]
... 25 common frames omitted
Comment From: snicoll
@sdeleuze is the registrar really necessary? Unless the implementation has changed, adding @Reflective
should register the annotation as well.
Now the agent is available it would be nice to have a test for this.
Comment From: sdeleuze
I will double check.
Comment From: sdeleuze
It does not work without the registrar (maybe something to refine on @Reflective
to refine later), I will add related tests.