IntelliJ IDEA使用Maven构建微服务架构SpringBoot


好记性不如一根烂笔头。-----------Banana • Banuit Gang(Banana-grapefruit Gang香柚帮BUG)


  虽说Maven的出现使我们只需要在pom.xml配置文件中配置一些参数,就可以帮助对各种依赖jar包进行更方便的管理,但是每次看到那么一大堆的依赖配置还是难免令人头大,特别是新手。

  而Spring Boot的出现,帮我们:

1,简化了复杂的依赖管理,简化编码

2,去除了大量的xml配置文件,简化配置

3,内置Servlet容器,不需要再打成war包,简化部署

4,提供准生产环境运行时的监控,简化监控

* 接下来就让大香蕉带大家快速搭建一个Spring Boot吧

1,首先启动IDEA,new一个新的projectIntelliJ IDEA使用Maven构建微服务架构SpringBoot_第1张图片

2,点击Next

IntelliJ IDEA使用Maven构建微服务架构SpringBoot_第2张图片

IntelliJ IDEA使用Maven构建微服务架构SpringBoot_第3张图片

IntelliJ IDEA使用Maven构建微服务架构SpringBoot_第4张图片

3,点击Finish,创建完成。 

4,新建BananaController.java,编写代码

IntelliJ IDEA使用Maven构建微服务架构SpringBoot_第5张图片

package com.example.demo.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Banana
 */
@RestController
public class BananaController {
	@RequestMapping("/")
	public String say() {
		return "I love Banana!";
	}
}

5,启动服务器

IntelliJ IDEA使用Maven构建微服务架构SpringBoot_第6张图片

6,在浏览器输入http://localhost:8080/

IntelliJ IDEA使用Maven构建微服务架构SpringBoot_第7张图片

你可能感兴趣的:(Java,Spring,Boot,微服务)