Home > Enterprise >  Not able to remove Hikari from Spring Boot project
Not able to remove Hikari from Spring Boot project

Time:11-08

Initially I added Hikari datasource in my project, but later I wanted to use JPA so i removed the dependencies from pom.xml. Now i'm using JPA. But when i start the project I see the logs which shows that Hikari pool started....

Here are the logs


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.5)

2022-11-07 03:57:53.329  INFO 18072 --- [           main] com.example.demo.BookControllerTests     : Starting BookControllerTests using Java 17.0.3 on Mahesh-PC with PID 18072 (started by v-mashelke in C:\Users\v-mashelke\Documents\workspace-spring-tool-suite-4-4.15.2.RELEASE\junit-rest-api-application)
2022-11-07 03:57:53.330  INFO 18072 --- [           main] com.example.demo.BookControllerTests     : No active profile set, falling back to 1 default profile: "default"
2022-11-07 03:57:53.820  INFO 18072 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-11-07 03:57:53.874  INFO 18072 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 43 ms. Found 1 JPA repository interfaces.
2022-11-07 03:57:54.409  INFO 18072 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2022-11-07 03:57:54.898  INFO 18072 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2022-11-07 03:57:54.969  INFO 18072 --- [           main] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-11-07 03:57:55.030  INFO 18072 --- [           main] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.12.Final
2022-11-07 03:57:55.103  INFO 18072 --- [           main] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-11-07 03:57:55.281  INFO 18072 --- [           main] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2022-11-07 03:57:55.633  INFO 18072 --- [           main] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-11-07 03:57:55.643  INFO 18072 --- [           main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-11-07 03:57:56.166  WARN 18072 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-11-07 03:57:56.703  INFO 18072 --- [           main] com.example.demo.BookControllerTests     : Started BookControllerTests in 3.609 seconds (JVM running for 5.396)

application.properties file

spring.jpa.dataplatform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa-show-sql=true
spring.datasource.url=jdbc:mysql://localhost:3306/neon
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.5</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>junit-rest-api-application</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>junit-rest-api-application</name>
    <description>Spring Security using JWT</description>
    <properties>
        <java.version>17</java.version>
    </properties>
    <dependencies>
        <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>

        <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->


        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

why the Hikari is still present ?

CodePudding user response:

Spring boot by default uses Hikari implementation for data source connection pool. You have dependency for spring-boot-starter-data-jpa, so that is where it is coming from.

  • Related