preface
Using Spring Boot makes it very easy and fast to set up projects, so we don’t have to worry about compatibility between frameworks, applicable versions, etc. We can use anything we want, just add a configuration.
Tip: The following is the body of this article, the following cases for reference
What is SpringBoot?
Spring Boot is a new framework from the Pivotal team designed to simplify the initial setup and development process for new Spring applications. The framework uses a specific way to configure so that developers no longer need to define boilerplate configurations.
Two, SpringBoot use steps
1. Import maven libraries
The code is as follows (example) :
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.41.</version> <relativePath/> </parent> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <! <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <! --> <dependency> <groupId>org.springframework. Boot </groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <! > <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional>
</dependency>
Copy the code
2. Write entry classes
The code is as follows (example) :
@SpringBootApplication
public class HyhBootApplication {
private static final Logger LOG = LoggerFactory.getLogger(HyhBootApplication.class);
public static void main(String[] args) {
SpringApplication.run(HyhBootApplication.class, args);
LOG.info("Hyh-boot application startup completed --"); }}Copy the code
3. Configuration file
The code is as follows (example) :
server:
port: 8088
Copy the code
Ok, so now the first SpringBoot program is done, isn’t it very simple, follow me, will take you into a better situation
conclusion
SpringBoot application makes coding easier