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 build the environment under SpringBoot idea

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

Share

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

This article mainly introduces how to build the environment under SpringBoot idea, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

Introduction to 1.Spring Boot

Introduction on wiki:

Spring Boot is Spring's general configuration solution for creating stand-alone, production-level Spring-based applications that can "run". [22] it is pre-configured with Spring's "insight view" of the best configuration and use of the Spring platform and third-party libraries, so you can start as little as possible. Most Spring Boot applications require very little Spring configuration. Characteristics:

Create a stand-alone Spring application

Directly embed Tomcat or Jetty (no need to deploy WAR files)

Provides a self-righteous "beginner" project object model (POM) to simplify your Maven configuration

Automatically configure Spring as much as possible

Provide production-ready features such as metrics, health checks, and externalized configuration

Absolutely no code generation, no XML configuration required

Create a project

Create a new maven project: open IDEA and select File- > New- > Project as shown below:

The editor takes you into the environment building and demo under SpringBoot (1) idea.

Locate the Maven project as shown in the following figure:

The editor takes you into the environment building and demo under SpringBoot (1) idea.

Then, fill in the items

The editor takes you into the environment building and demo under SpringBoot (1) idea.

3.pom.xml configuration

Refer to the example of spring's official website: https://spring.io/guides/gs/maven/#initial

As follows:? xml version= "1.0" encoding= "UTF-8"? >

4.0.0

Org.springframework

Myspringboot

Jar

0.1.0

1.8

1.8

Org.apache.maven.plugins

Maven-shade-plugin

2.1

Package

Shade

Com.demo.HelloWorld

Apart from the optional elements, this is the simplest pom.xml file necessary to build a Java project. It includes the following details of the project configuration:

. POM model version (always 4.0.0).

. The group or organization to which the project belongs. Is usually represented as a reverse domain name.

. The name of the artifact to give to the project library (for example, the name of its JAR or WAR file).

. The version of the project being built.

-how to package the project. For JAR file packaging, the default is "jar". Use "war" to package WAR files.

4. Add Startup Class

Create a package under the src/main/java path, which I named after com.demo. Create a new java class under the package, named HelloWorld as the startup class.

HelloWorld.java Code:

Package com.demo

Import org.springframework.boot.SpringApplication

Import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplicationbr/ > @ Controller

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