新增骨密度
parent
43576dca0b
commit
9bedd595c3
@ -1,13 +1,43 @@
|
|||||||
package com.ann.demo;
|
package com.ann.demo;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.ConfigurableApplicationContext;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@Slf4j
|
||||||
public class DemoApplication {
|
public class DemoApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(DemoApplication.class, args);
|
public static void main(String[] args) throws Exception {
|
||||||
|
ConfigurableApplicationContext application = SpringApplication.run(DemoApplication.class, args);
|
||||||
|
Environment env = application.getEnvironment();
|
||||||
|
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||||
|
String port = env.getProperty("server.port");
|
||||||
|
String property = env.getProperty("server.servlet.context-path");
|
||||||
|
String path = property == null ? "" : property;
|
||||||
|
System.out.println(
|
||||||
|
"\n\t" +
|
||||||
|
"----------------------------------------------------------\n\t" +
|
||||||
|
"Application Sailrui-Boot is running! Access URLs:\n\t" +
|
||||||
|
"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
|
||||||
|
"External: \thttp://" + ip + ":" + port + path + "/\n\t" +
|
||||||
|
"------------------------------------------------------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.ann.demo.util;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ProjectName:
|
||||||
|
* @Description:
|
||||||
|
* @Param 传输参数
|
||||||
|
* @Return
|
||||||
|
* @Author: 曾文和
|
||||||
|
* @CreateDate: 2020/8/4 14:18
|
||||||
|
* @UpdateUser: 曾文和
|
||||||
|
* @UpdateDate: 2020/8/4 14:18
|
||||||
|
* @UpdateRemark: 更新说明
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class ExceptionPrintUtil {
|
||||||
|
private static Logger log = LogManager.getLogger(ExceptionPrintUtil.class);
|
||||||
|
public static void printException(Exception e){
|
||||||
|
//方法名
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
e.printStackTrace(new PrintStream(baos));
|
||||||
|
String exception = baos.toString();
|
||||||
|
log.error(exception);
|
||||||
|
try {
|
||||||
|
baos.flush();
|
||||||
|
baos.close();
|
||||||
|
} catch (IOException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
#server.port= 8091
|
||||||
|
#server.address=localhost
|
Loading…
Reference in New Issue