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

Detailed introduction of the functions and features of spring boot2.0

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

Share

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

The main content of this article is "detailed introduction of the functions and features of spring boot2.0". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the "detailed introduction of the functions and features of spring boot2.0".

Starting from this article, spring boot2 is used as the main version of the introduction.

Spring boot 2 featur

Spring boot2 has been changed and enhanced in the following sections, and the related features will be gradually unfolded in the future.

Feature enhancement

Basic component upgrade:

JDK1.8+

Tomcat 8 +

Thymeleaf 3

Hibernate 5.2

Spring framework 5

Reactive Spring

Functional API

Kotlin support

Metrics

Security

Use change

Configuration property change

Gradle plug-in

Actuator endpoints

Dependency condition

Take the current GA version of spring boot 2.0.6 as an example, the dependency conditions are as follows:

Maven: 3.2 +

Gradle:4.x

Servlet container

The supported servlet container information is as follows:

Tomcat 8.5: servlet3.1

Jetty 9.4: servlet 3.1

Undertow 1.4: servlet 3.1

Pom.xml

Set the pom file as follows

The details of pom.xml file are as follows:

4.0.0 com.liumiaocn springbootdemo 0.0.1-SNAPSHOT jar springbootdemo springbootdemo project org.springframework.boot spring-boot-starter-parent 2.0.6.RELEASE UTF-8 UTF-8 1.8 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-maven-plugin

SpringbootdemoApplication

Liumiaocn:springbootdemo liumiao$ cat src/main/java/com/liumiaocn/springbootdemo/SpringbootdemoApplication.javapackage com.liumiaocn.springbootdemo;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.web.bind.annotation.RestController;import org.springframework.web.bind.annotation.RequestMapping;@RestController@SpringBootApplicationpublic class SpringbootdemoApplication {@ RequestMapping ("/") String home () {return "Hello, SpringBoot 2" } public static void main (String [] args) {SpringApplication.run (SpringbootdemoApplication.class, args);}} liumiaocn:springbootdemo liumiao$

RestController and RequestMapping annotations are both Spring MVC annotations used to quickly set route jump information

SpringBootApplication annotations are used for entry classes and are also one of the conditions to ensure that junit testing can be performed.

SPRING INITIALIZR

You can also use SPRING INITIALIZR to quickly create a spring boot project, as it has been explained in previous articles and will not be repeated here.

Access address: https://start.spring.io/

Compile & build & run

Compile & build

Compile command: mvn install

Running

Run the command: java-jar target/springbootdemo-0.0.1-SNAPSHOT.jar

Or use the mvn command: mvn spring-boot:run

Result confirmed

Liumiaocn:springbootdemo liumiao$ curl http://localhost:8080Hello, Spring Boot 2liumiaocn:springbootdemo liumiao$ here, I believe you have a deeper understanding of the "detailed introduction of the functions and features of spring boot2.0". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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