我正在尝试实现Pet Clinic的Spring Boot版本,尽可能少地覆盖Spring Boot默认值。
此时,我的退出链接似乎无法正常工作,而且我被告知这是因为我没有正确地将HttpSessionEventPublisher
添加到我的应用中。
如何将HttpSessionEventPublisher
添加到我的应用程序中?
我尝试过以下方法:
@Component
@Configuration
public class WebXmlConfig implements WebApplicationInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
servletContext.addListener(new HttpSessionEventPublisher());
}
}
和
@Bean
public ServletListenerRegistrationBean<HttpSessionEventPublisher> getHttpSessionEventPublisher() {
return new ServletListenerRegistrationBean<HttpSessionEventPublisher>(new HttpSessionEventPublisher());
}
我的主要课程没有扩展任何课程。如果我需要添加HttpSessionEventPublisher
,我还需要知道哪个类。
没有Spring Boot示例正确注销,因此我没有任何基于。
的内容任何帮助都将不胜感激。