@SpringBootApplication
public class YibutaskApplication {
public static void main(String[] args) {
SpringApplication.run(YibutaskApplication.class, args);
}
Logger logger =Logger.getLogger(YibutaskApplication.class);
@Bean
public TomcatServletWebServerFactory servletWebServerFactory(){
// String address = "localhost";
// Integer port = 12345;
String address=getIP();
System.out.println(address);
TomcatServletWebServerFactory container = new TomcatServletWebServerFactory();
try {
container.setAddress(InetAddress.getByName(address));
return container;
} catch (UnknownHostException e) {
logger.error("can not resolve host:" + address, e);
throw new RuntimeException("can not resolve host:" + address, e);
}
}
private String getIP(){
String address = "
springboot修改address为linux的etho地址
最新推荐文章于 2023-08-09 16:30:41 发布