Spring boot keeps session open

Asked

Viewed 234 times

0

I’m having trouble with my Spring boot api, I’m using JPA (Entitymanager), when startar the application is already open ten sessions without even making any request, already tested in three different banks and the same thing happens, someone has been through this problem?

2 answers

0

I don’t necessarily see this as a problem, when it goes up the application already opens a pool of connections to not have to open when you need, the configuration of this depends on how your setup is, if possible post your pom or gradlew for a more precise answer.

  • The problem is that my client is using the Firebird database and if the server is shut down with active sessions corrupts the bank, now when I use other banks I have no problem.

0

The problem is that my client is using the Firebird database and if the server is shut down with active sessions corrupts the bank, now when I use other banks I have no problem

This is my pom

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0

<artifactId>pedidos-api</artifactId>
<name>pedidos-api</name>
<description>Pedidos - Backend</description>
<packaging>jar</packaging>

<parent>
    <groupId>br.fps.ms</groupId>
    <artifactId>pedido</artifactId>
    <version>1.0.0</version>
</parent>  

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <keycloak.version>3.2.1.Final</keycloak.version>
    <commons-beanutils.version>1.9.3</commons-beanutils.version>
    <jtds.version>1.3.1</jtds.version>
</properties>

<dependencies>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>
    <dependency>
    <groupId>io.jsonwebtoken</groupId>
    <artifactId>jjwt</artifactId>
    <version>0.7.0</version>
</dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.0.3.Final</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-freemarker</artifactId>
    </dependency>
    <!--dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-spring-boot-starter</artifactId>
    </dependency-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.jtds</groupId>
        <artifactId>jtds</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.9.13</version>
    </dependency>
    <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
    </dependency>
    <!-- <dependency>
        <groupId>br.fps.ms</groupId>
        <artifactId>frontend</artifactId>
        <version>${project.version}</version>
        <scope>runtime</scope>
    </dependency> -->
    <!-- https://mvnrepository.com/artifact/org.firebirdsql.jdbc/jaybird -->
    <dependency>
        <groupId>org.firebirdsql.jdbc</groupId>
        <artifactId>jaybird</artifactId>
        <version>2.2.5</version>
    </dependency>
</dependencies>

<build>
    <finalName>pedidos-api</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>br.fps.ms.udic.Aplicacao</mainClass>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
    </plugins>
</build>

  • This should be included in your question and not in an answer. I recommend reading https://pt.meta.stackoverflow.com/a/5510/77268

Browser other questions tagged

You are not signed in. Login or sign up in order to post.