springboot获取内置tomcat端口
所属分类 springboot
浏览量 976
org.springframework.context.event.ContextRefreshedEvent
org.springframework.boot.web.servlet.context.ServletWebServerInitializedEvent
org.springframework.boot.context.event.ApplicationStartedEvent
org.springframework.boot.context.event.ApplicationReadyEvent
tomcat启动完成后发布 ServletWebServerInitializedEvent 事件
该事件可获取 端口
@Component
public class MyApplicationListener implements ApplicationListener{
@Override
public void onApplicationEvent(ApplicationEvent event){
ServletWebServerInitializedEvent e = (ServletWebServerInitializedEvent)event;
int port = e.getWebServer().getPort();
ContextStoppedEvent
ContextClosedEvent
ServletRequestHandledEvent
DispatcherServlet处理完一个HttpRequest请求后,发布 ServletRequestHandledEvent
public class ServletRequestHandledEvent extends RequestHandledEvent
上一篇
下一篇
feign ribbon 独立使用例子
springcloud zuul 简介
SpringBoot注册Servlet的三种方式
关于流计算的若干想法
SpringBoot admin 简介
spring如何解决循环依赖