Rev 23898 | Rev 23906 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.smartdukaan.cron;import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.boot.ApplicationArguments;import org.springframework.boot.ApplicationRunner;import org.springframework.boot.WebApplicationType;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.boot.builder.SpringApplicationBuilder;import org.springframework.cache.annotation.EnableCaching;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.ComponentScan;import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;import org.springframework.core.io.ClassPathResource;import org.springframework.scheduling.annotation.EnableScheduling;import com.smartdukaan.cron.migrations.RunOnceTasks;@SpringBootApplication@EnableCaching@EnableScheduling@ComponentScan("com.smartdukaan.cron.*, com.spice.profitmandi.common.*")public class Application implements ApplicationRunner{private static final Logger LOGGER=LogManager.getLogger(Application.class);public static void main(String[] args) throws Throwable {new SpringApplicationBuilder(Application.class).web(WebApplicationType.NONE).run(args);}@Beanpublic static PropertySourcesPlaceholderConfigurer propertyConfigurer1() {LOGGER.info("Called Configuration");PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();propertySourcesPlaceholderConfigurer.setLocation(new ClassPathResource("/META-INF/env.properties"));return propertySourcesPlaceholderConfigurer;}@Autowiredprivate RunOnceTasks runOnceTasks;@Overridepublic void run(ApplicationArguments args) throws Exception {LOGGER.info("Called run method");if(args.containsOption("once")) {runOnceTasks.getInvestmentDetails();System.exit(0);}}}