本文整理汇总了Java中org.springframework.boot.web.servlet.ServletListenerRegistrationBean.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ServletListenerRegistrationBean.setEnabled方法的具体用法?Java ServletListenerRegistrationBean.setEnabled怎么用?Java ServletListenerRegistrationBean.setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.web.servlet.ServletListenerRegistrationBean
的用法示例。
在下文中一共展示了ServletListenerRegistrationBean.setEnabled方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: singleSignOutHttpSessionListener
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; //导入方法依赖的package包/类
/**
* 注册单点登出listener
* @return
*/
@Bean
public ServletListenerRegistrationBean singleSignOutHttpSessionListener(){
ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean();
bean.setListener(new SingleSignOutHttpSessionListener());
// bean.setName(""); //默认为bean name
bean.setEnabled(true);
//bean.setOrder(Ordered.HIGHEST_PRECEDENCE); //设置优先级
return bean;
}
示例2: singleSignOutHttpSessionListener
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; //导入方法依赖的package包/类
/**
* 注册单点登出的listener
*
* @return
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@Bean
public ServletListenerRegistrationBean<?> singleSignOutHttpSessionListener() {
ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean();
bean.setListener(new SingleSignOutHttpSessionListener());
bean.setEnabled(true);
return bean;
}
示例3: log4jServletContextListener
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletListenerRegistrationBean log4jServletContextListener() {
final ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean();
bean.setEnabled(true);
bean.setName("log4jServletContextListener");
bean.setListener(new Log4jServletContextListener());
return bean;
}
示例4: log4jServletContextListener
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; //导入方法依赖的package包/类
@Bean
public ServletListenerRegistrationBean log4jServletContextListener() {
ServletListenerRegistrationBean bean = new ServletListenerRegistrationBean();
bean.setEnabled(true);
bean.setName("log4jServletContextListener");
bean.setListener(new Log4jServletContextListener());
return bean;
}
示例5: singleSignOutHttpSessionListener
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; //导入方法依赖的package包/类
/**
* For single point logout
*/
@Bean
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> singleSignOutHttpSessionListener() {
ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> listener = new ServletListenerRegistrationBean<>();
listener.setEnabled(true);
listener.setListener(new SingleSignOutHttpSessionListener());
listener.setOrder(1);
return listener;
}
示例6: monitoringSessionListener
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean; //导入方法依赖的package包/类
/**
* Registers the JavaMelody {@link SessionListener}.
* @param servletContext ServletContext
* @return ServletListenerRegistrationBean
*/
@Bean
public ServletListenerRegistrationBean<EventListener> monitoringSessionListener(
ServletContext servletContext) {
final ServletListenerRegistrationBean<EventListener> servletListenerRegistrationBean = new ServletListenerRegistrationBean<EventListener>(
new SessionListener());
if (servletContext.getFilterRegistration("javamelody") != null) {
// if webapp deployed as war in a container with MonitoringFilter and SessionListener already added by web-fragment.xml,
// do not add again
servletListenerRegistrationBean.setEnabled(false);
}
return servletListenerRegistrationBean;
}