MCPcopy Create free account
hub / github.com/diyhi/bbs / Application

Class Application

src/main/java/cms/Application.java:24–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23
24@EnableScheduling // 开启定时
25@SpringBootApplication(exclude = {FreeMarkerAutoConfiguration.class, JacksonAutoConfiguration.class})//取消freemarker、Jackson自动配置
26@ServletComponentScan("cms.config")
27public class Application {
28
29 public static void main(String[] args) {
30 boolean isMaven = false;//是否由maven插件启动
31 if(args != null){
32 for(String arg : args){
33 if(arg.equals("maven")){
34 isMaven = true;
35 }
36 }
37 }
38
39 //创建数据库分表实体类文件
40 CreateEntityFile.create();
41
42 if(!isMaven){
43 SpringApplication application = new SpringApplication(Application.class);
44 // application.addListeners(new InitApplicationListener());//注册监听器
45 // application.setAllowCircularReferences(Boolean.TRUE);//spring boot 2.6 允许循环引用
46 application.run(args);
47
48
49 }else{//maven命令执行
50 String user_dir = System.getProperty("user.dir");
51
52
53 //默认外部目录
54 String defaultExternalDirectory = "";
55
56 //论坛外部目录
57 Object externalDirectory = YmlUtils.getYmlProperty("application.yml","bbs.externalDirectory");
58 if(externalDirectory != null && !externalDirectory.toString().trim().isEmpty()){//如果已设置了论坛外部目录
59 defaultExternalDirectory = externalDirectory.toString();
60 }else{
61 defaultExternalDirectory = user_dir + File.separator + "target"+ File.separator + "bbs";
62
63 }
64 //生成外部文件夹
65 InstallComponent installComponent = new InstallComponent();
66 List<String> folderList = installComponent.folderList();
67 if(folderList != null && !folderList.isEmpty()){
68 for(String folderPath : folderList){
69 //生成文件目录
70 Path path = Paths.get(defaultExternalDirectory+File.separator+ Strings.CS.replace(folderPath, "/", File.separator));
71
72 if (!Files.exists(path, LinkOption.NOFOLLOW_LINKS)) {//目录不存在
73 try {
74
75 Files.createDirectories(path);
76 } catch (IOException e) {
77 e.printStackTrace();
78 }
79 }
80 }
81 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…