话不多说,直接上代码(喜欢的留下个赞吧)
package cn.tj.runner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
@Component
public class TjWebApplicationEunner implements ApplicationRunner{
private Logger log = LoggerFactory.getLogger(this.getClass());
@Value("${server.port}")
private int prot;
@Override
public void run(ApplicationArguments args) throws Exception {
log.info("XXX项目部署完成,访问地址:http://localhost:"+prot);
}
}
|