2022-04-24 12:09:30 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
|
|
|
|
|
|
* No deletion without permission, or be held responsible to law.
|
|
|
|
|
|
*/
|
|
|
|
|
|
package com.jeesite.modules;
|
|
|
|
|
|
|
|
|
|
|
|
import com.jeesite.common.config.Global;
|
2023-08-30 15:32:57 +08:00
|
|
|
|
import com.jeesite.common.io.FileUtils;
|
2024-04-01 12:02:36 +08:00
|
|
|
|
import com.jeesite.common.lang.StringUtils;
|
2022-04-24 12:09:30 +08:00
|
|
|
|
import com.jeesite.common.web.BaseController;
|
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
2024-04-01 12:02:36 +08:00
|
|
|
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
2022-04-24 12:09:30 +08:00
|
|
|
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
|
|
|
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
|
|
|
|
|
|
import java.net.UnknownHostException;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* Application
|
|
|
|
|
|
* @author ThinkGem
|
|
|
|
|
|
*/
|
|
|
|
|
|
@SpringBootApplication
|
|
|
|
|
|
public class FastApplication extends SpringBootServletInitializer {
|
|
|
|
|
|
|
2024-07-25 11:36:22 +08:00
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(FastApplication.class);
|
2022-04-24 12:09:30 +08:00
|
|
|
|
|
|
|
|
|
|
public static void setJeeSiteInitDataProperty() {
|
|
|
|
|
|
// 删除这个设置,启动系统时,将不会进行检测初始化数据库
|
|
|
|
|
|
System.setProperty("jeesite.initdata", "true");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws UnknownHostException {
|
|
|
|
|
|
FastApplication.setJeeSiteInitDataProperty();
|
|
|
|
|
|
SpringApplication.run(FastApplication.class, args);
|
2024-04-01 12:02:36 +08:00
|
|
|
|
String vuePath = Global.getProperty("vuePath");
|
|
|
|
|
|
String ctxPath = Global.getProperty("server.servlet.context-path");
|
|
|
|
|
|
if (StringUtils.isNoneBlank(vuePath, ctxPath)) {
|
|
|
|
|
|
logger.info(
|
|
|
|
|
|
"\r\n\r\n==============================================================\r\n"
|
|
|
|
|
|
+ "\r\n 存在此提示:因为您修改了 server.servlet.context-path 参数,需要您"
|
|
|
|
|
|
+ "\r\n 同步修改 jeesite-vue/.env.tomcat 中的 VITE_PUBLIC_PATH 并重新打包 "
|
|
|
|
|
|
+ "\r\n 如:context-path: " + ctxPath +" 即对应为 VITE_PUBLIC_PATH = " + ctxPath + vuePath
|
|
|
|
|
|
+ "\r\n\r\n==============================================================\r\n");
|
|
|
|
|
|
}
|
2022-04-24 12:09:30 +08:00
|
|
|
|
logger.info(
|
|
|
|
|
|
"\r\n\r\n==============================================================\r\n"
|
|
|
|
|
|
+ "\r\n 启动完成,访问地址:http://127.0.0.1:"
|
2023-08-30 15:32:57 +08:00
|
|
|
|
+ Global.getProperty("server.port") + FileUtils.path("/"
|
|
|
|
|
|
+ Global.getProperty("server.servlet.context-path"))
|
|
|
|
|
|
+ "\r\n\r\n 默认管理账号: system 密码: admin"
|
2022-04-24 12:09:30 +08:00
|
|
|
|
+ "\r\n\r\n==============================================================\r\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
|
|
|
|
|
this.setRegisterErrorPageFilter(false); // 错误页面有容器来处理,而不是SpringBoot
|
|
|
|
|
|
FastApplication.setJeeSiteInitDataProperty();
|
|
|
|
|
|
return builder.sources(FastApplication.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Controller
|
2024-04-01 12:02:36 +08:00
|
|
|
|
@ConditionalOnProperty(name = "server.servlet.context-path", havingValue = "")
|
|
|
|
|
|
public static class JeeSiteController extends BaseController {
|
2022-04-24 12:09:30 +08:00
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/js/**")
|
|
|
|
|
|
public String login() {
|
2024-04-01 12:02:36 +08:00
|
|
|
|
return REDIRECT + Global.getProperty("defaultPath");
|
2022-04-24 12:09:30 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|