У меня есть фильтр в моем приложении Spring-Boot.
@Component
public class WebFilter extends GenericFilterBean
{
@Override
public void doFilter (ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
HttpServletRequest req = (HttpServletRequest) request;
HttpServletResponse res = (HttpServletResponse) response;
HttpSession ses = req.getSession ();
if (ses.isNew () == true)
{
System.out.println ("NEW");
}
chain.doFilter (req, res);
}
}
Если Spring-Security отключен, то NEW появится в самом первом запросе.
Я отключаю его в своем основной класс.
@SpringBootApplication (exclude = SecurityAutoConfiguration.class)
public class MyApp
{
public static void main (String args []) throws Exception
{
...
Если он включен, он никогда не появится (может быть, потому что Security обрабатывает CORS?).
Как я могу получить фильтр, который обрабатывает самый первый запрос (поэтому появится NEW)