建议启动类这样写!!!

建议启动类这样写!!!

@Slf4j
@SpringBootApplication
@EnableCaching
@MapperScan("com.zyxx.**.mapper")
public class SpringBootMiniApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(SpringBootMiniApplication.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        log.info("
----------------------------------------------------------
	" +
                "Application Declare is running! Access URLs:
	" +
                "Local: 		http://localhost:" + port + path + "/
	" +
                "External: 	http://" + ip + ":" + port + path + "/
	" +
                "Swagger-UI: 		http://" + ip + ":" + port + path + "/doc.html
" +
                "----------------------------------------------------------");
    }
}
经验分享 程序员 微信小程序 职场和发展