@SpringBootApplication
@Slf4j
public class Demo1Application {
public static void main(String[] args) {
// SpringApplication.run(Demo1Application.class, args);
SpringApplication app = new SpringApplication(Demo1Application.class);
Environment env = app.run(args).getEnvironment();
System.out.println("启动成功!!");
System.out.println("根地址: \t\thttp://localhost:" + env.getProperty("server.port"));
System.out.println("登录接口: \thttp://localhost:" + env.getProperty("server.port") + "/user/login?loginName=test&password=test");
}
}
- 启动浏览器在Web Browsers中自行配置。
- application中要配置server.port=xxxx,否则控制台打印的端口号为null。