搭建springboot+spring cloud config+euerka

本人公司使用的就是springboot+ eureka +spring cloud config + zuul 这一套,而且也不涉及负载....,毕竟小公司...,还不涉及高并发的问题。

关于eureka、spring cloud config、zuul搭建过程:

https://blog.csdn.net/zc_ad/article/details/85328858

https://blog.csdn.net/zc_ad/article/details/85334027

https://blog.csdn.net/zc_ad/article/details/85334382

1.maven依赖


    org.springframework.boot
    spring-boot-starter


    org.springframework.cloud
    spring-cloud-starter


    org.springframework.cloud
    spring-cloud-config-client



    org.springframework.cloud
    spring-cloud-starter-eureka

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项目就可以搭建成功了。

 

 

你可能感兴趣的:(SpringCloud,SpringBoot,springboot,项目整合及进阶)