springboot2微服务入门案例、多图傻瓜式
环境
你好!开始前, 先叨叨下,感觉必须写下环境 ,免得同学们在学习过程中,遇到和我一样的坑(像小猪乔治一样踩了很多水坑,浪费了很多宝贵时间),看前人的文章和案例,自己再写代码的时候,总是这样那样的问题,好多原因都是环境的问题,特别是依赖包新版本不向后兼容的问题,比如springboot版本。如下:
IDEA2019.2、JDK1.8.0_151、springboot2.1.7.RELEASE、springcloudGreenwich.SR2
当然吃水不忘挖井人,之前学习了springboot+springcloud基础微服务架构,在它基础上完成的这篇文章,感谢。
一. 建maven项目
二、用spring Initialize建eureka注册服务模块
pom代码不用动,如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.yw</groupId>
<artifactId>