package com.hx.phip;
|
|
import com.hx.util.AesUtil;
|
import com.hx.phip.config.UniqueNameGenerator;
|
import org.mybatis.spring.annotation.MapperScan;
|
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.boot.web.servlet.support.SpringBootServletInitializer;
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.context.annotation.ComponentScan;
|
|
@SpringBootApplication
|
@MapperScan({"com.gitee.sunchenbin.mybatis.actable.dao.*","com.hx.phip.dao.*"})
|
@ComponentScan(basePackages = {"com.gitee.sunchenbin.mybatis.actable.manager.*","com.hx.phip.*","com.hx.common.service.impl","com.hx.redis","com.hx.mybatis.aes.springbean"},nameGenerator = UniqueNameGenerator.class)
|
@ServletComponentScan
|
//@EnableScheduling
|
@EnableDiscoveryClient
|
@EnableFeignClients
|
public class PhiPlatformUserApplication extends SpringBootServletInitializer implements CommandLineRunner {
|
|
public static void main(String[] args) {
|
|
//获取项目部署路径
|
String jarWholePath = PhiPlatformUserApplication.class.getProtectionDomain().getCodeSource().getLocation().getFile();
|
/*try {
|
jarWholePath = java.net.URLDecoder.decode(jarWholePath, "UTF-8");
|
System.setProperty("address.jarWholePath", jarWholePath);
|
} catch (UnsupportedEncodingException e) { System.out.println(e.toString()); }
|
String jarPath = new File(jarWholePath).getParentFile().getAbsolutePath();
|
System.setProperty("address.jarPath", jarPath);*/
|
|
if(System.getProperty("os.name").contains("dows")) {
|
jarWholePath = jarWholePath.substring(1,jarWholePath.length());
|
}
|
if(jarWholePath.contains("jar")) {
|
jarWholePath = jarWholePath.substring(0,jarWholePath.lastIndexOf("."));
|
jarWholePath = jarWholePath.substring(0,jarWholePath.lastIndexOf("/"));
|
}
|
jarWholePath = jarWholePath.replace("target/classes/", "").replace("file:","");
|
System.setProperty("address.jarPath",jarWholePath );
|
|
//设置配置文件项加密密钥(放在这里使加密密钥和密文分开)
|
System.setProperty("jasypt.encryptor.password", AesUtil.SECRET);
|
SpringApplication.run(PhiPlatformUserApplication.class, args);
|
}
|
|
@Override
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
return builder.sources(PhiPlatformUserApplication.class);
|
}
|
|
@Override
|
public void run(String... args) {
|
System.out.println("SpringBoot is Running...");
|
}
|
}
|