In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
How to use SpringBoot to write the first program Helloworld, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
1. System requirements
Java 8
Maven 3.3 +
Idea 2019 +
2.HelloWorld
Requirements: browse to send / hello request, respond to Hello,Spring Boot 2
2.1Create a maven project
2.2 introduce dependency org.springframework.boot spring-boot-starter-parent 2.3.4.RELEASE org.springframework.boot spring-boot-starter-web 2.3 to create main program / * main program class * @ SpringBootApplication: this is a SpringBoot application * / @ SpringBootApplicationpublic class MainApplication {public static void main (String [] args) {SpringApplication.run (MainApplication.class,args) Write Business @ RestControllerpublic class HelloController {@ RequestMapping ("/ hello") public String handle01 () {return "Hello, Spring Boot 2!";}}
2.5 Test
Just run the main method directly
The browser displays:
2.6 simplify configuration
Available application.properties
Server.port=8888
2.7 simplify deployment of org.springframework.boot spring-boot-maven-plugin
Package the project into a jar package and execute it directly on the target server.
Enter the folder such as target:
The cmd window executes the selected jar:
The browser displays:
Note: cancel the quick editing mode of cmd
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.