我是靠谱客的博主 可靠白云,这篇文章主要介绍springboot中Listener的配置方法,现在分享给大家,希望可以做个参考。

App启动类需配置注解

@ServletComponentScan

 

监听器上需要配置注解

@WebListener

 

Listener示例

package org.goldwind.common;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
* @author 葛楠 	E-mail:gnan1992@126.com
* @version 创建时间:2017年5月27日 下午4:06:17
* 类说明
*/
@WebListener
public class IndexListener implements ServletContextListener{

	@Override
	public void contextDestroyed(ServletContextEvent event) {
		
	}

	@Override
	public void contextInitialized(ServletContextEvent event) {
		
	}
	
}

 

最后

以上就是可靠白云最近收集整理的关于springboot中Listener的配置方法的全部内容,更多相关springboot中Listener内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(137)

评论列表共有 0 条评论

立即
投稿
返回
顶部