Spring Cloud Netflix 学习笔记(〇)——引言
此过程中使用的软件版本号如下:
jdk:8
Spring Boot:2.3.9.RELEASE
Spring Cloud :Hoxton.SR10
Netflix:2.2.7.RELEASE
Oracle:11g
另外,偷个懒,直接使用Oracle官方提供的scott账户下的EMP和DEPT两张表了。表结构如下:
SQL> desc emp
Name Type Nullable Default Comments
-------- ------------ -------- ------- --------
EMPNO NUMBER(4)
ENAME VARCHAR2(10) Y
JOB VARCHAR2(9) Y
MGR NUMBER(4) Y
HIREDATE DATE Y
SAL NUMBER(7,2) Y
COMM NUMBER(7,2) Y
DEPTNO NUMBER(2) Y
SQL> desc dept
Name Type Nullable Default Comments
------ ------------ -------- ------- --------
DEPTNO NUMBER(2)
DNAME VARCHAR2(14) Y
LOC VARCHAR2(13) Y
准备工作:创建Spring Cloud父工程
使用IDEA + Spring Initializr快速创建一个Spring Boot工程,就命名为springcloud吧,并在pom.xml中添加如下内容:
<!--指定打包方式-->
<packaging>pom</packaging>
<properties>
<!--指定Spring Cloud版本号-->
<spring.cloud-version>Hoxton.SR10</spring.cloud-version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring.cloud-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!--一些公共依赖-->
<dependencies>
<!--Spring web-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--actuator-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!--开发者工具 主要用于配合IDEA热部署-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<!--lombok-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>