JAVA-8794: Fix circular dependency issue in spring-boot-libraries-2
This commit is contained in:
parent
6ac9d1eb87
commit
077898aaa5
@ -1,15 +1,11 @@
|
||||
package com.baeldung;
|
||||
|
||||
import com.baeldung.jobrunr.service.SampleJobService;
|
||||
import org.jobrunr.jobs.mappers.JobMapper;
|
||||
import org.jobrunr.scheduling.JobScheduler;
|
||||
import org.jobrunr.scheduling.cron.Cron;
|
||||
import org.jobrunr.storage.InMemoryStorageProvider;
|
||||
import org.jobrunr.storage.StorageProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
@ -23,13 +19,6 @@ public class JobRunrSpringBootApp {
|
||||
SpringApplication.run(JobRunrSpringBootApp.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public StorageProvider storageProvider(JobMapper jobMapper) {
|
||||
InMemoryStorageProvider storageProvider = new InMemoryStorageProvider();
|
||||
storageProvider.setJobMapper(jobMapper);
|
||||
return storageProvider;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void scheduleRecurrently() {
|
||||
jobScheduler.<SampleJobService>scheduleRecurrently(Cron.every5minutes(), x -> x.executeSampleJob("a recurring job"));
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.baeldung.config;
|
||||
|
||||
import org.jobrunr.jobs.mappers.JobMapper;
|
||||
import org.jobrunr.storage.InMemoryStorageProvider;
|
||||
import org.jobrunr.storage.StorageProvider;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class StorageProviderConfig {
|
||||
|
||||
@Bean
|
||||
public StorageProvider storageProvider(JobMapper jobMapper) {
|
||||
InMemoryStorageProvider storageProvider = new InMemoryStorageProvider();
|
||||
storageProvider.setJobMapper(jobMapper);
|
||||
return storageProvider;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user