Spring Boot Security wiele otwartych connections po samej konfiguracji

0

Witam moja aplikacja jest zdeployowana na Heroku, który ma bardzo niski limit na ilość połączeń (20). Właśnie dlatego muszę uważnie patrzeć na każde otwarte połączenie. Z moim kodem ilość połączeń skacze z 0 do 10 po jedynie odświeżeniu strony. Dlaczego tak się dzieje? Oto mój kod:

package pl.jawegiel.springsecurityexample;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import javax.sql.DataSource;

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Autowired
    private DataSource dataSource;

    @Override
    public void configure(HttpSecurity http) throws Exception {
        http
                .cors().and().csrf().disable()
                .authorizeRequests().antMatchers("/getUsersInfo")
                .fullyAuthenticated().and().httpBasic();

    }


    @Override
    public void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.jdbcAuthentication().dataSource(dataSource).passwordEncoder(new BCryptPasswordEncoder())
                .usersByUsernameQuery("SELECT username, password, 'true' as enabled from users where username=?")
                .authoritiesByUsernameQuery("SELECT username, role FROM users WHERE username=?");
    }
}

w application.properties:

spring.datasource.url=...
spring.datasource.platform=postgres
spring.datasource.username=...
spring.datasource.password=...

oraz mój controller.java

@RestController
@CrossOrigin(origins = "*")
public class Controller {

    @Autowired
    private UserService userService;

    @GetMapping("/")
    public String abc() {
        return "abc";
    }

...

}

DAJE PUNKTY ZA SENSOWNE ODPOWIEDZI!

1

spring.datasource.hikari.maxium-pool-size jeśli masz pod spodem hikari data source? Bo default to właśnie 10 ;] Ze spring security nie ma to nic wspólnego, ewentualnie spring.datasource.maxium-pool-size albo spring.datasource.pool-size bo nie wiem dokładnie co się stanie jak robisz to na pałe tym domyślnym spring.datasource bez zadnej konfiguracji.
Ale znając springa to pewnie każda z tych 3 opcji zadziała.

1 użytkowników online, w tym zalogowanych: 0, gości: 1