-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Describe the bug
If you define multiple methods annotated as @Scheduled
they override configurations.
First:
@ApplicationScoped
class StaticScheduler {
@Scheduled(cron = "0 1 * * * ?")
public static void scheduledStatic(){
System.out.println("scheduledStatic");
}
}
second:
@ApplicationScoped
class ScheduledNonStatic {
@Scheduled(cron = "1 * * * * ?")
public void scheduledNonStatic(){
System.out.println("scheduledNonStatic");
}
}
effective configuration visible in dev-ui:
And scheduledStatic
is called with the same trigger as scheduledNonStatic
. Original configuration is ignored.
Expected behavior
Configurations should not be overridden. Methods should work with they own triggers.
Actual behavior
The last loaded method definition overrides all other definitions.
How to Reproduce?
Example application could be found here:
https://github.com/Koziolek/quarkus-scheduler-fail
Output of uname -a
or ver
Linux koziolek-desktop3 5.8.0-43-generic #49~20.04.1-Ubuntu SMP Fri Feb 5 09:57:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Lin
Output of java -version
openjdk version "21" 2023-09-19 OpenJDK Runtime Environment (build 21+35-2513) OpenJDK 64-Bit Server VM (build 21+35-2513, mixed mode, sharing)
Quarkus version or git rev
3.22.1
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937) Maven home: /home/koziolek/.sdkman/candidates/maven/current Java version: 21, vendor: Oracle Corporation, runtime: /home/koziolek/.sdkman/candidates/java/21-open Default locale: pl_PL, platform encoding: UTF-8 OS name: "linux", version: "5.8.0-43-generic", arch: "amd64", family: "unix"
Additional information
Tested on 3.22.1 and 3.21.1 on java 21 and java 24