| Line 1... |
Line 1... |
| 1 |
package com.smartdukaan.cron;
|
1 |
package com.smartdukaan.cron;
|
| 2 |
|
2 |
|
| 3 |
import org.apache.logging.log4j.LogManager;
|
3 |
import org.apache.logging.log4j.LogManager;
|
| 4 |
import org.apache.logging.log4j.Logger;
|
4 |
import org.apache.logging.log4j.Logger;
|
| - |
|
5 |
import org.springframework.beans.factory.annotation.Autowired;
|
| - |
|
6 |
import org.springframework.boot.ApplicationArguments;
|
| - |
|
7 |
import org.springframework.boot.ApplicationRunner;
|
| 5 |
import org.springframework.boot.WebApplicationType;
|
8 |
import org.springframework.boot.WebApplicationType;
|
| 6 |
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
9 |
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
| 7 |
import org.springframework.boot.builder.SpringApplicationBuilder;
|
10 |
import org.springframework.boot.builder.SpringApplicationBuilder;
|
| 8 |
import org.springframework.cache.annotation.EnableCaching;
|
11 |
import org.springframework.cache.annotation.EnableCaching;
|
| 9 |
import org.springframework.context.annotation.Bean;
|
12 |
import org.springframework.context.annotation.Bean;
|
| 10 |
import org.springframework.context.annotation.ComponentScan;
|
13 |
import org.springframework.context.annotation.ComponentScan;
|
| 11 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
14 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
| 12 |
import org.springframework.core.io.ClassPathResource;
|
15 |
import org.springframework.core.io.ClassPathResource;
|
| 13 |
import org.springframework.scheduling.annotation.EnableScheduling;
|
16 |
import org.springframework.scheduling.annotation.EnableScheduling;
|
| 14 |
|
17 |
|
| - |
|
18 |
import com.smartdukaan.cron.migrations.RunOnceTasks;
|
| - |
|
19 |
|
| 15 |
|
20 |
|
| 16 |
@SpringBootApplication
|
21 |
@SpringBootApplication
|
| 17 |
@EnableCaching
|
22 |
@EnableCaching
|
| 18 |
@EnableScheduling
|
23 |
@EnableScheduling
|
| 19 |
@ComponentScan("com.smartdukaan.cron.*, com.spice.profitmandi.common.*")
|
24 |
@ComponentScan("com.smartdukaan.cron.*, com.spice.profitmandi.common.*")
|
| 20 |
public class Application {
|
25 |
public class Application implements ApplicationRunner{
|
| 21 |
|
26 |
|
| 22 |
private static final Logger LOGGER=LogManager.getLogger(Application.class);
|
27 |
private static final Logger LOGGER=LogManager.getLogger(Application.class);
|
| 23 |
|
28 |
|
| 24 |
public static void main(String[] args) throws Throwable {
|
29 |
public static void main(String[] args) throws Throwable {
|
| 25 |
new SpringApplicationBuilder(Application.class).web(WebApplicationType.NONE).run(args);
|
30 |
new SpringApplicationBuilder(Application.class).web(WebApplicationType.NONE).run(args);
|
| Line 31... |
Line 36... |
| 31 |
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
|
36 |
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
|
| 32 |
propertySourcesPlaceholderConfigurer.setLocation(new ClassPathResource("/META-INF/env.properties"));
|
37 |
propertySourcesPlaceholderConfigurer.setLocation(new ClassPathResource("/META-INF/env.properties"));
|
| 33 |
return propertySourcesPlaceholderConfigurer;
|
38 |
return propertySourcesPlaceholderConfigurer;
|
| 34 |
}
|
39 |
}
|
| 35 |
|
40 |
|
| - |
|
41 |
@Autowired
|
| - |
|
42 |
private RunOnceTasks runOnceTasks;
|
| - |
|
43 |
@Override
|
| - |
|
44 |
public void run(ApplicationArguments args) throws Exception {
|
| - |
|
45 |
LOGGER.info("Called run method");
|
| - |
|
46 |
if(args.containsOption("once")) {
|
| - |
|
47 |
runOnceTasks.populateGrnTimestamp();
|
| - |
|
48 |
System.exit(0);
|
| - |
|
49 |
}
|
| - |
|
50 |
|
| - |
|
51 |
}
|
| - |
|
52 |
|
| 36 |
}
|
53 |
}
|