spring-boot-starter-web
org.springframework.boot
spring-boot-starter-tomcat
provided
org.springframework.boot
spring-boot-starter-freemarker
org.springframework.boot
spring-boot-starter-cache
org.springframework.boot
spring-boot-starter-actuator
org.springframework.boot
spring-boot-starter-logging
org.springframework.boot
spring-boot-devtools
true
org.springframework.cloud
spring-cloud-starter-config
org.springframework.cloud
spring-cloud-starter-eureka-server
1.3.1.RELEASE
org.springframework.cloud
spring-cloud-starter-contract-stub-runner
test
org.springframework.cloud
spring-cloud-starter-contract-verifier
test
org.springframework.cloud
spring-cloud-stream-test-support
test
org.apache.commons
commons-lang3
3.5
javax.servlet
javax.servlet-api
3.0.1
commons-lang
commons-lang
2.6
五、创建如图所示的目录结构:
①编写注册中心,注册中心目录结构:
编写WebApplication启动类,添加注解@EnableEurekaServer和@SpringBootApplication,我这里想做一个纯注册中心,不与数据库挂钩,所以增加了一个exclude = DataSourceAutoConfiguration.class,启动项目时不自动与数据库连接,若想让注册中心也连接数据库,这个exclude也可以不要。如图所示: