阅读 24

建议springboot启动类这样写!!!

建议启动类这样写!!! 建议启动类这样写!!! 建议启动类这样写!!! 建议启动类这样写!!! 建议启动类这样写!!!

@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("\n----------------------------------------------------------\n\t" +
                "Application Declare is running! Access URLs:\n\t" +
                "Local: \t\thttp://localhost:" + port + path + "/\n\t" +
                "External: \thttp://" + ip + ":" + port + path + "/\n\t" +
                "Swagger-UI: \t\thttp://" + ip + ":" + port + path + "/doc.html\n" +
                "----------------------------------------------------------");
    }
}


```
复制代码
文章分类
前端
文章标签