Skip to content

Instantly share code, notes, and snippets.

@os890
Created October 26, 2015 16:30
type-safe config with producer
@TypeSafeConfig
public interface AppConfig2 {
String name();
@Produces //since ds v1.5.1
ApplicationVersion version();
}
//example for injecting and using type-safe configs
@Scheduled(cronExpression = "0 0/10 * * * ?")
public class CustomBatchStarter2 implements org.quartz.Job {
@Inject
private LogService logService;
@Inject
private ApplicationVersion version;
@Inject
private BatchConfig batchConfig;
@Inject
private CustomBatchService batchService;
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
logService.log(appConfig.name(), version, getClass().getName() + " started");
batchService.start(batchConfig.batchSize());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment