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

How to initialize Spring Boot and add dependencies in Spring Boot + Mybatis + Spring MVC environment configuration

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article will explain in detail how to initialize Spring Boot and add dependencies in Spring Boot + Mybatis + Spring MVC environment configuration. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

Take a look at Spring Boot's official introduction, http://spring.io/projects/spring-boot:

Spring Boot allows developers to save most of the Spring configuration so that they only need to focus on major development and a small amount of Spring configuration.

Embedded Tomcat, most of the dependencies have been defined, simplifying the construction configuration of the project. When we use it, we don't have to worry about the compatibility between frameworks, applicable versions and other issues, what we want to use, just add a configuration, so using spring boot is very suitable for building micro-services.

The first step is to visit https://start.spring.io/ to generate a spring boot project

After it is generated, a compressed package will be downloaded. After decompressing it, Import will be the Maven project in Eclipse.

The second step is to add additional needed dependencies, such as Mybatis

The pom.xml content is as follows:

4.0.0 com.kai demo 0.0.1-SNAPSHOT jar demo Demo project for Spring Boot org.springframework.boot spring-boot-starter-parent 2.0.4.RELEASE UTF-8 UTF -8 1.8 org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-test Test org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-devtools true Mysql mysql-connector-java org.mybatis mybatis 3.4.6 Org.mybatis mybatis-spring 1.3.2 org.apache.logging.log4j log4j 2.11.1 pom Org.springframework spring-jdbc com.zaxxer HikariCP 3.2.0 Org.springframework.boot spring-boot-maven-plugin true

Introduction of web module

Spring Boot Web Starter

Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container

Org.springframework.boot spring-boot-starter-web

There are two modules by default in the pom.xml file:

Spring-boot-starter: core modules, including autoconfiguration support, logging, and YAML

Spring-boot-starter-test: test module, including JUnit, Hamcrest, Mockito.

Debugging of development environment

Hot start is already very common in normal development projects. Although during the development of web projects, changes to project startup and restart always report an error, springBoot supports debugging very well and can take effect in real time after modification. You need to add the following configurations:

This is the end of org.springframework.boot spring-boot-devtools true org.springframework.boot spring-boot-maven-plugin true's article on "how to initialize Spring Boot and add dependencies in Spring Boot + Mybatis + Spring MVC environment configuration". Hope that the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good, please 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

Development

Wechat

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

12
Report