Spring Boot does not invariably invoke the Hibernate package. It depends on how the application is configured. By default, Spring Boot uses Hibernate as the default ORM framework. However, if you want to use MyBatis or any other ORM framework, you need to configure it explicitly in your application.
If you are experiencing an error while attempting to utilize MyBatis, it might be due to conflicting dependencies between Hibernate and MyBatis. To resolve this issue, you can exclude the Hibernate dependencies from your project by adding the following exclusion to your pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</exclusion>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</exclusion>
</exclusions>
</dependency>
Alternatively, you can use the mybatis-spring-boot-starter dependency, which will automatically configure MyBatis in your Spring Boot application.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-03 07:08:50 +0000
Seen: 11 times
Last updated: May 03 '23