提交 a0baef78 编写于 作者: 如梦技术's avatar 如梦技术 🐛

如果有 swagger,打印 swagger ui 地址。

上级 1ca175c7
......@@ -23,6 +23,7 @@ import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
/**
......@@ -43,5 +44,11 @@ public class StartEventListener {
int localPort = event.getWebServer().getPort();
String profile = StringUtils.arrayToCommaDelimitedString(environment.getActiveProfiles());
log.info("\n---[{}]---启动完成,当前使用的端口:[{}],环境变量:[{}]---", appName, localPort, profile);
// 如果有 swagger,打印开发阶段的 swagger ui 地址
if (ClassUtils.isPresent("springfox.documentation.spring.web.plugins.Docket", null)) {
log.info("\nhttp://localhost:{}/swagger-ui.html", localPort);
} else {
log.info("\nhttp://localhost:{}", localPort);
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册