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

Method main

src/main/java/cms/Application.java:29–84  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

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 }
82 }
83
84 }
85
86}

Callers

nothing calls this directly

Calls 10

createMethod · 0.95
getYmlPropertyMethod · 0.95
folderListMethod · 0.95
getPropertyMethod · 0.80
getMethod · 0.80
equalsMethod · 0.45
runMethod · 0.45
isEmptyMethod · 0.45
toStringMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected