增加项目成功的地址打印

This commit is contained in:
季圣华
2020-11-01 22:08:53 +08:00
parent abf50e4731
commit 9be0bcc80c

View File

@@ -1,17 +1,27 @@
package com.jsh.erp; package com.jsh.erp;
import com.jsh.erp.utils.ComputerInfo;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import java.io.IOException;
@SpringBootApplication @SpringBootApplication
@MapperScan(basePackages = {"com.jsh.erp.datasource.mappers"}) @MapperScan("com.jsh.erp.datasource.mappers")
@ServletComponentScan @ServletComponentScan
@EnableScheduling @EnableScheduling
public class ErpApplication{ public class ErpApplication{
public static void main(String[] args) { public static void main(String[] args) throws IOException {
SpringApplication.run(ErpApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(ErpApplication.class, args);
Environment environment = context.getBean(Environment.class);
System.out.println("启动成功访问地址http://" + ComputerInfo.getIpAddr() + ":"
+ environment.getProperty("server.port") + "测试用户jsh密码123456");
} }
} }