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 first springboot project

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

How to build the first springboot project, for this problem, this article details the corresponding analysis and solution, hoping to help more small partners who want to solve this problem find a simpler and easier way.

Using idea to build the first springboot project I. Advantages of springboot

From the official website:

1: Create a standalone Spring application

2: Embed Tomcat, Jetty or Undertow directly (no WAR file required)

3: Provide self-righteous "starter" dependencies to simplify build configuration

4: Automatically configure Spring and third-party libraries whenever possible

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

6: Absolutely no code generation and no XML configuration required

ps: In fact, in addition to the above advantages, springboot can be used out of the box, simple to build, and support for maven and gralde, and has strong community support, many contributors provide more excellent pluggable components to use, I think this is the most powerful place of springboot.

Maybe some people think Springboot is a microservice framework, but I think Springboot is a web framework, but it is the best microservice support framework in the existing web framework. Springboot supports many microservice frameworks, such as Springcloud, dubbo, etc.

Second, use idea to build the first springboot project

1: Start

2: Give the project a name

3: Select Core Dependency Module

4: Specify the project path

Start your first web project

Using the project just built, you can see the following project directory, default to maven, if the idea implementation is not configured, will use maven official mirror repo.maven.apache.org If you often use maven students can configure the domestic mirror station, such as Alibaba Cloud maven mirror station

1: Project Directory

2:pom.xml

4.0.0 org.springframework.boot spring-boot-starter-parent 2.1.6.RELEASE com.code.calvin boot-helloworld 0.0.1-SNAPSHOT boot-helloworld Demo project for Spring Boot 1.8 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-maven-plugin

BootApplication.java

@SpringBootApplicationpublic class BootApplication { public static void main(String[] args) { SpringApplication.run(BootApplication.class, args); }}

the first controller

/** * @author calvin * @date 2019/07/24 */@RestController@RequestMapping("/hello")public class HelloController { /** * Request greeting for first interface * @param name Call name * @return greeting */ @GetMapping("/say") public String sayHello(String name){ return "Welcome to Springboot " + name; }} Run to see the effect

1: run-> BootApplication.main()

2: Browser access interface

Welcome to Springboot Calvin has returned.

IV. Summary

1: This article briefly describes the official website explanation of springboot, and its advantages

2: Simple use of idea and maven for the first springboot project to build

3: The first interface, return greeting, test program runs successfully

The answer to the question about how to build the first springboot project is shared here. I hope the above content can help you to some extent. If you still have a lot of doubts, you can pay attention to the industry information channel to learn more about it.

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