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

The construction process of SpringBoot micro-service project

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

Share

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

This article mainly introduces "the construction process of SpringBoot microservices project". In daily operation, I believe many people have doubts about the construction process of SpringBoot microservices project. I have consulted all kinds of materials and sorted out simple and easy operation methods. I hope to help you answer the doubts of "the construction process of SpringBoot microservices project"! Next, please follow the small series to learn together!

Creating a maven project with IDEA

1.file>project

2.next

3. Fill in grupId,atifactId of maven project directly next

4. After filling in the project name click Finish to complete the maven project creation.

5.Add springboot dependencies to pom.xml file

org.springframework.boot spring-boot-starter-parent 2.0.0.RELEASE

org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-test test

6. Create the package and create an Application.java startup file under the package root directory.

package com;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplicationpublic class DockerApplication {

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

7. Create a Controller tagged @RestController, add an interface method and annotate @RequestMapping("/") to set the access path.

package com.controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;

@RestControllerpublic class DockerController {

@RequestMapping("/") public String index() { return "Hello springboot! "; }}

8. Move the cursor to the Application.java file, right-click, run the main method to start the embedded tomacat, port default 8080

9. Console startup success log.

10. The browser accesses the interface address and returns the result "Hello springboot! "。

At this point, the study of "the construction process of SpringBoot microservice project" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!

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