-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathHealthNutrition.java
More file actions
88 lines (68 loc) · 3.18 KB
/
HealthNutrition.java
File metadata and controls
88 lines (68 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.health;
import java.io.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import com.health.threadpool.TaskProcessingService;
import com.health.utility.CommonData;
@ServletComponentScan
@SpringBootApplication
@EnableCaching
@PropertySource("classpath:git.properties")
@EnableAsync
public class HealthNutrition extends org.springframework.boot.web.servlet.support.SpringBootServletInitializer
implements CommandLineRunner {
private static final Logger logger = LoggerFactory.getLogger(HealthNutrition.class);
@Autowired
private Environment env;
@Autowired
private TaskProcessingService taskProcessingService;
@Value("${git.commit.id}")
private String gitCommitId;
@Value("${createdby}")
private String createdBy;
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(HealthNutrition.class);
}
public static void main(String[] args) {
SpringApplication.run(HealthNutrition.class, args);
}
@Override
public void run(String... args) throws Exception {
logger.info("Starting application {}", gitCommitId);
logger.info("Checking application properties: created by {}", createdBy);
try {
taskProcessingService.createOutlineFile();
taskProcessingService.addTokenInTrainingResource();
taskProcessingService.addAllBrochureToQueue();
taskProcessingService.addAllResearchPapertoQueue();
taskProcessingService.addAllTuttorialsToQueue();
taskProcessingService.intializeQueue();
taskProcessingService.deleteQueueByApiStatus();
taskProcessingService.queueProcessor();
} catch (Exception e) {
logger.error("Exception: ", e);
}
String baseDir = env.getProperty("spring.applicationexternalPath.name");
new File(baseDir + CommonData.uploadDirectoryCategory).mkdirs();
new File(baseDir + CommonData.uploadDirectoryQuestion).mkdirs();
new File(baseDir + CommonData.uploadDirectoryTutorial).mkdirs();
new File(baseDir + CommonData.uploadUserImage).mkdirs();
new File(baseDir + CommonData.uploadDirectoryTestimonial).mkdirs();
new File(baseDir + CommonData.uploadDirectoryMasterTrainer).mkdirs();
new File(baseDir + CommonData.uploadDirectoryEvent).mkdirs();
new File(baseDir + CommonData.uploadDirectoryMasterTrainerFeedback).mkdirs();
new File(baseDir + CommonData.uploadLiveTutorial).mkdirs();
}
}