From 619ba38a206adda0767b6de205d43f091c11c671 Mon Sep 17 00:00:00 2001 From: Alejandro Revilla Date: Wed, 29 Dec 2021 17:39:32 -0300 Subject: [PATCH] AutoConfigure Quartz Jobs --- .../quartz/src/main/java/org/jpos/q2/QuartzJobSupport.java | 1 + modules/quartz/src/main/java/org/jpos/q2/TestJob.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/quartz/src/main/java/org/jpos/q2/QuartzJobSupport.java b/modules/quartz/src/main/java/org/jpos/q2/QuartzJobSupport.java index 55af45118a..cbb048336f 100644 --- a/modules/quartz/src/main/java/org/jpos/q2/QuartzJobSupport.java +++ b/modules/quartz/src/main/java/org/jpos/q2/QuartzJobSupport.java @@ -66,6 +66,7 @@ public void execute (JobExecutionContext ctx) throws JobExecutionException { if (o instanceof QuartzAdaptor.Q2Adaptor) { adaptor = (QuartzAdaptor.Q2Adaptor) o; log = new Log(adaptor.getLogger(), adaptor.getRealm()); + QFactory.autoconfigure(this, adaptor.getConfiguration()); setConfiguration(adaptor.getConfiguration()); } run(); diff --git a/modules/quartz/src/main/java/org/jpos/q2/TestJob.java b/modules/quartz/src/main/java/org/jpos/q2/TestJob.java index 2db8706dd0..c3d34059e0 100644 --- a/modules/quartz/src/main/java/org/jpos/q2/TestJob.java +++ b/modules/quartz/src/main/java/org/jpos/q2/TestJob.java @@ -18,9 +18,14 @@ package org.jpos.q2; +import org.jpos.core.annotation.Config; + public class TestJob extends QuartzJobSupport { + @Config("message") + private String message; + public void run() { - getLog().info(cfg.get ("message")); + getLog().info(message); } }