In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about how to build a Spring Boot environment, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
First, create a simple Maven project
With Maven, you can automatically import packages that many programs depend on into your project by importing Spring Boot's starter module. With Maven's parent POM, it is also easier to manage dependent versions and use the default configuration, and modules in the project can easily inherit it. Add the following dependencies to pom.xml:
Org.springframework.boot spring-boot-starter-parent 1.5.8.RELEASE org.springframework.boot spring-boot-starter-web II. Create a SpringBoot application package com.lemon.springboot.example;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController / * @ author lemon * / @ SpringBootApplication@RestControllerpublic class Application {@ RequestMapping ("/") public String home () {return "hello";} public static void main (String [] args) {SpringApplication.run (Application.class, args);}}
This simple example is an entry to the SpringBoot application, or the main program, where @ SpringBootApplication is used to mark it as a SpringBoot application, and the main method makes it a main program, which will first execute the main method when the application starts, and then @ RestController indicates that the program is still a controller. If you visit the root directory of the project in the browser, it will return the string hello.
III. Start the project
Start the project, that is, run the main method, visit http://localhost:8080/ in the browser, and you will see that hello is displayed on the page. In fact, Tomcat is integrated in the dependency, and the server service is provided by Tomcat.
The above is how to build the Spring Boot environment, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.