本人公司使用的就是springboot+ eureka +spring cloud config + zuul 这一套,而且也不涉及负载....,毕竟小公司...,还不涉及高并发的问题。
关于eureka、spring cloud config、zuul搭建过程:
SpringCloud之搭建Eureka_兮川的博客-优快云博客
Springcloud之搭建Spring Cloud Config_兮川的博客-优快云博客_springcloud 搭建springcloud 中的config 模块
Springcloud之搭建Zuul_兮川的博客-优快云博客
1.maven依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>
2.在config-server中添加wechat.yml文件
spring:
profiles: dev
druid:
allow:
ip: 127.0.0.1
login:
user_name: root
password: root
swagger:
enable: true
info:
version: 0.1
title: 微信接口
description: 薛定谔的猫,你不去验证,就无法知道真假
user_name: xichuan
url:
email:
3.设置bootstrap.yml
server:
port: 80
eureka:
instance:
preferIpAddress: true
leaseRenewalIntervalInSeconds: 1
leaseExpirationDurationInSeconds: 2
nonSecurePort: ${server.port}
client:
serviceUrl:
defaultZone: http://localhost:2001/eureka/
spring:
application:
name: wechat
cloud:
config:
profile: dev
discovery:
enabled: true
serviceId: xichuan-config-server
4.在启动类上添加注解
@SpringBootApplication
@EnableEurekaClient
public class XichuanWechatApplication {
public static void main(String[] args) {
SpringApplication.run(XichuanWechatApplication.class, args);
}
}
此springboot项目就可以搭建成功了。
github上有我更多的笔记:Raray-chuan (兮川) · GitHub,欢迎stars与following,如果有问题可以在issue中向我咨询
关注我的公众号,获取更多关于后端、大数据的知识