How to understand the springboot framework
Spring Boot is a new framework provided by the Pivotal team. It is designed to simplify the initial construction and development process of new Spring applications. The framework uses an ad hoc approach to configuration, eliminating the need for developers to define boilerplate configurations.
The operating environment of this tutorial: windows7 system, java10 version, DELL G3 computer.
1. Origin
Spring Boot is a new framework provided by the Pivotal team. It is designed to simplify the initial construction and development process of new Spring applications. The framework uses an ad hoc approach to configuration, eliminating the need for developers to define boilerplate configurations. To understand it in my own words, Spring Boot is actually not a new framework. It configures the use of many frameworks by default, just like Maven integrates all Jar packages and Spring Boot integrates all frameworks.
2. Solve the problem
Build services faster and more conveniently, greatly saving workload, as follows:
1) Configure web.xml and load it Spring and Spring mvc
2) Configure database connection and configure Spring transaction
3) Configure reading of loaded configuration files and enable annotations
4) Configuration log file
...
After the configuration is completed, deploy Tomcat for debugging. It may be necessary for even a small function, so it is really troublesome to do it all over again! ! !
The introduction of springboot will make it a thing of the past
3. Getting started with springBoot
There are many ways to build it, with Idea Introduction to building a project
1. Select File -> New —> Project... A box to create a new project will pop up
- ##2. Select Spring Initializr, Next will also have a configuration interface similar to the above. Idea helped us with the integration
- 3. After filling in the relevant content, click Next, select the dependent package and click Next, and finally confirm Click Finish if the information is correct.
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
@RestController public class HelloWorldController { @RequestMapping("/hello") public String index() { return "Hello World"; } }
@RunWith(SpringRunner.class) @SpringBootTest
public class HelloWorldControlerTests { private MockMvc mvc; @Before public void setUp() throws Exception { mvc = MockMvcBuilders.standaloneSetup(new HelloWorldController()).build(); } @Test public void getHello() throws Exception { mvc.perform(MockMvcRequestBuilders.get("/hello").accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn(); } }
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <fork>true</fork> </configuration> </plugin> </plugins> </build>
The above is the detailed content of How to understand the springboot framework. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

