0

i had one project with apache ninja using java 8 and postgres 9.6. I needed to migrate this to spring boot only. I am using spring boot 2.5.x. but when i configured this project it is running 10x slower than apache ninja. i found jdbc connection is taking too much time to acquire and execution. in my apache project i was using

<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>

i was not able to use same in spring boot.

below is my pom.xml for spring boot


    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.5.12</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <java.version>8</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.7.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.zaxxer</groupId>
            <artifactId>HikariCP</artifactId>
        </dependency>

just help how can i fix it so it can perform at least same like apache ninja 10x faster.

3
  • Without knowing what you are doing with configuration and code this will be impossible to answer. The exclusion will do nothing here as HikariCP is already the default connection pool. So remove the exclude and the com.zaxxer dependency as those are already included. Commented Mar 11, 2024 at 9:50
  • thanks for your response i have provided more details in my answer. Commented Mar 11, 2024 at 10:12
  • Don't put additional details in an answer, instead edit your question. One thing is why are you not using the default SPring Boot auto-configuration which does optimizations for JPA as well. If you don't have multipe datasources use the default configuration. Next what configuration did you use previously as you should move that to SPring Boot (the number of connections, timeouts etc.). Finally don't use a connectionTestQuery as Hikari will automatically use the JDBC 4connection validation which is better. Commented Mar 11, 2024 at 10:27

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.