Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the problems encountered in SpringBoot2.1.6 integration

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail the problems encountered in the integration of SpringBoot2.1.6, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

Project configuration pom file:

4.0.0

Www.3wd.top

SpringBoot

SpringBoot-1.0

Org.springframework.boot

Spring-boot-starter-parent

2.1.6.RELEASE

2.1.0

Mysql

Mysql-connector-java

8.0.16

1.2.58

1.1.18

1.0.2

2.1.5

1.2.12

1.3.7

28.0-jre

Org.springframework.boot

Spring-boot-starter-web

Org.mybatis.spring.boot

Mybatis-spring-boot-starter

${mybatis.spring.boot}

Tk.mybatis

Mapper-spring-boot-starter

${tk.mybatis.version}

Com.github.pagehelper

Pagehelper-spring-boot-starter

${com.github.pagehelper.version}

Org.mybatis.generator

Mybatis-generator-core

${org.mybatis.generator.version}

Compile

True

Org.springframework.boot

Spring-boot-starter-aop

Org.springframework.boot

Spring-boot-starter-test

Test

Com.alibaba

Druid-spring-boot-starter

${alibaba.druid.version}

${jdbc.driver.groupId}

${jdbc.driver.artifactId}

${jdbc.driver.version}

Org.springframework.boot

Spring-boot-starter-jdbc

Org.springframework.boot

Spring-boot-starter-freemarker

Javax.persistence

Persistence-api

${javax.persistence.api}

Org.apache.commons

Commons-lang3

Com.google.guava

Guava

${com.google.guava.version}

War

Top

Src/main/resources

True

Org.springframework.boot

Spring-boot-maven-plugin

Org.mybatis.generator

Mybatis-generator-maven-plugin

${basedir} / src/main/resources/generator/generatorConfig.xml

True

True

Maven-resources-plugin

UTF-8

Org.apache.maven.plugins

Maven-surefire-plugin

True

Question 1:

Creating a new SqlSession

SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1e0721ac] was not registered for synchronization because synchronization is not active

JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@196918e2] will not be managed by Spring

Cause: no configuration of control of things

Solution: add @ EnableTransactionManagement to the startup class and @ Transactional declaration transaction to the implementation class

Question 2: NoSuchMethodException: tk.mybatis.mapper.provider.base.BaseInsertProvider. ()

Cause: the reason is that when you integrate packages that use tk.mybatis, the k.mybatis-related packages are imported into the dao interface, while the packages imported by the @ MapperScan annotation in the Application startup class are org.mybatis.spring.annotation.MapperScan. Causes initialization failure in the k.mybatis package

Solution: the @ MapperScan annotation package in the Application startup class uses the import tk.mybatis.spring.annotation.MapperScan; package to scan the Mapper interface

Problem 3: using log in @ Slf4j annotation to report an error

Cause: maybe the development tools you use don't integrate lombok.jar.

Solution: copy the version of jar that relies on lombok.jar in your project. Take eclipse as an example:

Copy this lombok.jar to your eclipse level directory, then add-javaagent:D:\ eclipse-jee-2019-06\ lombok.jar to eclipse.ini and reopen eclipse

Lombok.jar: download address https://www.projectlombok.org/all-versions

What are the problems encountered in the integration of SpringBoot2.1.6 to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report