设置入口位置
settings -> Editor -> Live Template
java
分类,点击右侧的+
按钮
live template
OK
或者 apply
即可生效改模版块app.run
效果如下
设置的代码块
public static void main(String[] args) throws UnknownHostException {
SpringApplication app = new SpringApplication($NAME$.class);
Environment env = app.run(args).getEnvironment();
String protocol = "http";
log.info("\n----------------------------------------------------------\n\t" +
"Application '{}' is running! Access URLs:\n\t" +
"Local: \t\t{}://localhost:{}\n\t" +
"External: \t{}://{}:{}\n\t" +
"ApiDocs: \t{}\n" +
"ContextPath: \t{}\n----------------------------------------------------------",
env.getProperty("spring.application.name"),
protocol,
env.getProperty("server.port"),
protocol,
InetAddress.getLocalHost().getHostAddress(),
env.getProperty("server.port"),
env.getProperty("application.doc"),
env.getProperty("server.servlet.context-path")
);
}
这里的函数NAME需要手动设置为ClassName(),方法如下
日志打印(后面自己被注解@SLfj代替
时间格式化
Donate
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有