| | |
| | | package com.dy.sso.util; |
| | | |
| | | import jakarta.servlet.ServletContext; |
| | | import jakarta.servlet.ServletContextEvent; |
| | | import jakarta.servlet.ServletContextListener; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import com.dy.pipIrrGlobal.util.OrgListenerSupport; |
| | | import org.springframework.boot.context.event.ApplicationReadyEvent; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Slf4j |
| | | public class SsoListener implements ServletContextListener { |
| | | @Component |
| | | public class SsoListener extends OrgListenerSupport implements ApplicationListener<ApplicationReadyEvent> { |
| | | |
| | | |
| | | @Override |
| | | public void contextInitialized(ServletContextEvent event) { |
| | | ServletContextListener.super.contextInitialized(event); |
| | | ServletContext con = event.getServletContext(); |
| | | public void onApplicationEvent(ApplicationReadyEvent event) { |
| | | try { |
| | | //等1秒,等待com.alibaba.druid.pool.DruidDataSource实始化完成 |
| | | Thread.sleep(1000L); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | //初始化机构 |
| | | super.init(); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void contextDestroyed(ServletContextEvent event) { |
| | | ServletContextListener.super.contextDestroyed(event); |
| | | } |
| | | |
| | | } |