Security——禁用jsessionid
作者:互联网
如果自定义登录流程,很可能会报错,提示url中间不允许出现 “;”。
因为系统老是自动拼接上jsessionid,这时候增加一个配置类即可。
import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.context.annotation.Configuration; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.SessionTrackingMode; import java.util.Collections; /** * 禁用jsessionid * * @author Mr.css * @date 2022-01-06 18:34 */ @Configuration public class CustomServletContextInitializer implements ServletContextInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { servletContext.setSessionTrackingModes(Collections.singleton(SessionTrackingMode.COOKIE)); } }
标签:SessionTrackingMode,禁用,jsessionid,import,Security,Configuration,servlet,javax 来源: https://www.cnblogs.com/chenss15060100790/p/15773711.html