搭建springboot+spring cloud config+euerka

本人公司使用的就是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中向我咨询

关注我的公众号,获取更多关于后端、大数据的知识

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值