简体   繁体   中英

Spring boot with Spring security automatically stopped working after some time

I have a Spring boot application and using Spring security in it.

Whats happening is, after some time may be 24-28 hours it stopped working. By stopped working I mean, user gets the default spring security login page and when he login nothing works.

Basically all the protected API stopped working and the logs prints nothing , it just stopped. I tried many different solution but nothing is working.

It starts working when I restart the application.

I thought this is happening since more sessions might be piling up and the application is not removing the session. So, I added a session a timeout and verified that the session is not there, still this is happening.

Also when that happens, all the public API still works and logs print data for them

the below configuration I am using :

http
                .addFilterAfter(oAuth2ClientContextFilter(), AbstractPreAuthenticatedProcessingFilter.class)
                .httpBasic().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/login"))
                .and()
                .authorizeRequests()
                .antMatchers("/sping", "/ping","/gridsearch/completerequest","/cache/refresh","/searchtest/sessionsList").permitAll()
                .anyRequest().authenticated()
                .and()
                .sessionManagement().sessionFixation().migrateSession().maximumSessions(1);

Thanks to @jzheaux, I figure out the problem was not in Spring Security, it was in the jdbcTemplate.

I was using the BasicDataSource of dbcp2. I haven't provided the timeout to it, hence the jdbcTemplate was waiting for the connection for forever, keeping the application suspended.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM