This is the 7th day of my participation in the November Gwen Challenge. Check out the details: The last Gwen Challenge 2021

【 a Point of the Day 】

Chakra first appeared in the novel “The Return of the Condor Heroes”. The weapon held by the King of The Golden Wheel is called Chakra.

One, foreword

There are many Maven+SpringBoot projects on the web, so I’ll talk about them now.

Two, Maven and SpringBoot introduction and function

1. What is Maven? Introduction and functions of Maven

Maven is a project management tool that enables building and dependency management of Java projects. Simply put, if your Java project lacks a tool, add a dependency to the pom.xml file, Maven finds it, downloads it, and then uses it. Maven is a tool kit that allows you to improve your small and big projects. If you need any tools, tell it and use them.

2. What is SpringBoot? Introduction and function of SpringBoot

SpringBoot is an enhanced version of Spring, an open source application framework for the Java platform. It can be a little foundation for your Java project, a directory of content for your little work. In plain English: SpringBoot is an enhanced version of the Spring framework, with many more tools written in itself. Originally, Spring configuration is required to add Tomcat to complete the Web project, but SpringBoot, is already combined with Tomcat.

Third, the relationship between them

First of all, SpringBoot is just a great framework to aid development and a great tool. Therefore, we must have a tool kit first, without which we cannot have tools. Without further ado, let’s simply roll it up and do a simple project (Maven+SpringBoot).

Create a simple Maven + SpringBoot project

The Eclipse version

Creating a Maven project

Click on “File” for New Maven ProjectNext,”Enter Group Id, Arifact Id — and FinishSuccessfully createdMavenProject, viewpom.xmlfile Add the SpringBoot framework

Here I’m going to be very simple and rough.

Add directly to the POM fileparentNotes andDeveloping Web projects requires dependenciesSticky notes

< the parent > tag(The project tagBelow)

  <! -- Inherits dependencies provided by SpringBoot's parent project -->
  <parent>
  	<groupId>org.springframework.boot</groupId>
  	<artifactId>spring-boot-starter-parent</artifactId>
  	<version>2.2.6. RELEASE</version>
  	<relativePath />
  </parent>
Copy the code



<! -- SpringBoot development web project needs dependencies -->
        <dependency>
  		<groupId>org.springframework.boot</groupId>
  		<artifactId>spring-boot-starter-web</artifactId>
  	</dependency>
Copy the code

The complete POM.xml file

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>com.nanfangzhe</groupId>
	<artifactId>anpai-demo</artifactId>
	<version>0.0.1 - the SNAPSHOT</version>
	<packaging>jar</packaging>

	<name>anpai-demo</name>
	<url>http://maven.apache.org</url>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>

	<! -- Inherits dependencies provided by SpringBoot's parent project -->
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.2.6. RELEASE</version>
		<relativePath />
	</parent>
	<dependencies>
		<! -- SpringBoot development web project needs dependencies -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>

Copy the code

Once added, you may have to wait for the Maven library to update for a while. Add springApplication.run (app.class, args) to the main method.

App.java complete code

package com.nanfangzhe.anpai_demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/** * Hello world! * * /
@SpringBootApplication
public class App {
	public static void main(String[] args) {
		System.out.println("Hello World!"); SpringApplication.run(App.class, args); }}Copy the code

A successful outcome

— “Start project –” successfully show results

【 the 】

Thank you for reading the end, if you have a different view, you are welcome to leave a comment below this article. I am a southerner who loves computers and loves the motherland.