| Line 1... |
Line 1... |
| 1 |
package com.smartdukaan.cron;
|
1 |
package com.smartdukaan.cron;
|
| 2 |
|
2 |
|
| - |
|
3 |
import java.util.Properties;
|
| - |
|
4 |
|
| 3 |
import org.apache.logging.log4j.LogManager;
|
5 |
import org.apache.logging.log4j.LogManager;
|
| 4 |
import org.apache.logging.log4j.Logger;
|
6 |
import org.apache.logging.log4j.Logger;
|
| 5 |
import org.springframework.beans.factory.annotation.Autowired;
|
7 |
import org.springframework.beans.factory.annotation.Autowired;
|
| 6 |
import org.springframework.boot.ApplicationArguments;
|
8 |
import org.springframework.boot.ApplicationArguments;
|
| 7 |
import org.springframework.boot.ApplicationRunner;
|
9 |
import org.springframework.boot.ApplicationRunner;
|
| Line 11... |
Line 13... |
| 11 |
import org.springframework.cache.annotation.EnableCaching;
|
13 |
import org.springframework.cache.annotation.EnableCaching;
|
| 12 |
import org.springframework.context.annotation.Bean;
|
14 |
import org.springframework.context.annotation.Bean;
|
| 13 |
import org.springframework.context.annotation.ComponentScan;
|
15 |
import org.springframework.context.annotation.ComponentScan;
|
| 14 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
16 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
| 15 |
import org.springframework.core.io.ClassPathResource;
|
17 |
import org.springframework.core.io.ClassPathResource;
|
| - |
|
18 |
import org.springframework.mail.javamail.JavaMailSender;
|
| - |
|
19 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
| 16 |
import org.springframework.scheduling.annotation.EnableScheduling;
|
20 |
import org.springframework.scheduling.annotation.EnableScheduling;
|
| 17 |
|
21 |
|
| 18 |
import com.smartdukaan.cron.migrations.RunOnceTasks;
|
22 |
import com.smartdukaan.cron.migrations.RunOnceTasks;
|
| 19 |
|
23 |
|
| 20 |
|
24 |
|
| Line 35... |
Line 39... |
| 35 |
LOGGER.info("Called Configuration");
|
39 |
LOGGER.info("Called Configuration");
|
| 36 |
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
|
40 |
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
|
| 37 |
propertySourcesPlaceholderConfigurer.setLocation(new ClassPathResource("/META-INF/env.properties"));
|
41 |
propertySourcesPlaceholderConfigurer.setLocation(new ClassPathResource("/META-INF/env.properties"));
|
| 38 |
return propertySourcesPlaceholderConfigurer;
|
42 |
return propertySourcesPlaceholderConfigurer;
|
| 39 |
}
|
43 |
}
|
| - |
|
44 |
|
| - |
|
45 |
@Bean(name="mailSender")
|
| - |
|
46 |
public JavaMailSender getGmailSender(){
|
| - |
|
47 |
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
| - |
|
48 |
|
| - |
|
49 |
//Using gmail
|
| - |
|
50 |
mailSender.setHost("smtp.sendgrid.net");
|
| - |
|
51 |
mailSender.setPort(587);
|
| - |
|
52 |
mailSender.setUsername("shop2020");
|
| - |
|
53 |
mailSender.setPassword("U2/=fP,t");
|
| - |
|
54 |
|
| - |
|
55 |
Properties javaMailProperties = new Properties();
|
| - |
|
56 |
javaMailProperties.put("mail.smtp.starttls.enable", "false");
|
| - |
|
57 |
javaMailProperties.put("mail.smtp.auth", "true");
|
| - |
|
58 |
javaMailProperties.put("mail.transport.protocol", "smtp");
|
| - |
|
59 |
javaMailProperties.put("mail.debug", "true");//Prints out everything on screen
|
| - |
|
60 |
|
| - |
|
61 |
mailSender.setJavaMailProperties(javaMailProperties);
|
| - |
|
62 |
return mailSender;
|
| - |
|
63 |
}
|
| 40 |
|
64 |
|
| 41 |
@Autowired
|
65 |
@Autowired
|
| 42 |
private RunOnceTasks runOnceTasks;
|
66 |
private RunOnceTasks runOnceTasks;
|
| 43 |
@Override
|
67 |
@Override
|
| 44 |
public void run(ApplicationArguments args) throws Exception {
|
68 |
public void run(ApplicationArguments args) throws Exception {
|