基于spring-boot创建一个module提供服务

使用mysql数据库,dao使用mybatis,数据库连接池使用阿里的druid

添加maven依赖

<parent>
<groupId>com.dh.cloud</groupId>
<artifactId>spring-cloud-demo</artifactId>
<version>1.0-SNAPSHOT</version>
</parent> <properties>
<docker.image.prefix>lihong</docker.image.prefix>
</properties> <dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
</dependency> <dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency> <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.1.1</version>
</dependency>
<!-- mysql 驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency> <dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.0.26</version>
</dependency>
</dependencies>

在resource目录下添加文件application.yml和bootstrap.yml

application.yml文件内容

server:
port: 8081 eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/ endpoints:
shutdown:
enabled: true
restart:
enabled: true
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
username:
password:
url:

bootstrap.yml文件内容

spring:
application:
name: user-provider-service

spring-cloud 学习三 服务提供者的更多相关文章

  1. spring cloud学习(三)使用Ribbon实现客户端负载均衡

    使用Ribbon实现客户端的负载均衡 * 个人博客空间 : https://zggdczfr.cn/ * Ribbon Spring Cloud Netflix Ribbon 是一个客户端负载均衡的组 ...

  2. spring cloud学习(三) 断路器

    在Spring Cloud中使用了Hystrix 来实现断路器的功能.Hystrix是Netflix开源的微服务框架套件之一,该框架目标在于通过控制那些访问远程系统.服务和第三方库的节点,从而对延迟和 ...

  3. Spring Cloud 学习 (三) Feign

    新建 spring-cloud-eureka-feign-client Module pom <parent> <artifactId>spring-cloud-parent& ...

  4. Spring Cloud(三):服务提供与调用 Eureka【Finchley 版】

    Spring Cloud(三):服务提供与调用 Eureka[Finchley 版]  发表于 2018-04-15 |  更新于 2018-05-07 |  上一篇文章我们介绍了 Eureka 服务 ...

  5. Spring Cloud学习(一):Eureka服务注册与发现

    1.Eureka是什么 Eureka是Netflix开发的服务发现框架,本身是一个基于REST的服务,主要用于定位运行在AWS域中的中间层服务,以达到负载均衡和中间层服务故障转移的目的. Eureka ...

  6. spring cloud 学习(9) - turbine stream无法在eureka注册的解决办法

    turbine是啥就不多解释了,初次接触的可以移步spring cloud 学习(4) - hystrix 服务熔断处理 拉到最后看一下,turbine stream默认情况下启动成功后,eureka ...

  7. spring cloud 学习资料

    spring cloud 学习资料 网址 拜托!面试请不要再问我Spring Cloud底层原理 https://mp.weixin.qq.com/s/ZH-3JK90mhnJPfdsYH2yDA

  8. Spring Boot和Spring Cloud学习资源推荐

    Spring Boot和Spring Cloud学习资源推荐   比较好的学习资源,分享一下. 1.Spring Boot官方文档:http://projects.spring.io/spring-b ...

  9. Spring Cloud 学习 之 Spring Cloud Eureka(源码分析)

    Spring Cloud 学习 之 Spring Cloud Eureka(源码分析) Spring Boot版本:2.1.4.RELEASE Spring Cloud版本:Greenwich.SR1 ...

  10. 断路器Hystrix与Turbine集群监控-Spring Cloud学习第三天(非原创)

    文章大纲 一.Hystrix基础介绍二.断路器Hystrix简单使用三.自定义Hystrix请求命令四.Hystrix的服务降级与异常处理五.Hystrix的请求缓存与请求合并六.Hystrix仪表盘 ...

随机推荐

  1. 一步一步学习FastJson1.2.47远程命令执行漏洞

    本文首发于先知:https://xz.aliyun.com/t/6914 漏洞分析 FastJson1.2.24 RCE 在分析1.2.47的RCE之前先对FastJson1.2.24版本中的RCE进 ...

  2. Flutter移动电商实战 --(32)列表页_小类高亮交互效果制作

    点击大类右侧的横向的小类红色显示当前的小类别 解决之前溢出的问题: 先解决一个bug,之前右侧的这里设置的高度是1000,但是有不同的虚拟机和手机设别的问题造成了溢出的问题 Expaned是有伸缩能力 ...

  3. 《你不知道的JavaScript(上)》笔记——关于this

    this 指向函数的作用域是一种常见的误解,this 在任何情况下都不指向函数的词法作用域. 在 JavaScript 内部, 作用域确实和对象类似, 可见的标识符都是它的属性. 但是作用域" ...

  4. tomcat部署web项目的问题

    1:启动窗口乱码 原因 Tomcat默认都是UTF-8的,但是控制台是GBK的,要保持一致 解决办法 打开tomcat目录下的conf/目录下logging.properties找到java.util ...

  5. LC 983. Minimum Cost For Tickets

    In a country popular for train travel, you have planned some train travelling one year in advance.  ...

  6. oracle-sql脚本

    select * from dba_users; create tablespace kyc_coo; create user kyc_coo identified by "123456&q ...

  7. Swift 常量

    常量一旦设定,在程序运行时就无法改变其值. 常量可以是任何的数据类型如:整型常量,浮点型常量,字符常量或字符串常量.同样也有枚举类型的常量: 常量类似于变量,区别在于常量的值一旦设定就不能改变,而变量 ...

  8. Oracle SQL的优化

    SQL的优化应该从5个方面进行调整:1.去掉不必要的大型表的全表扫描2.缓存小型表的全表扫描3.检验优化索引的使用4.检验优化的连接技术5.尽可能减少执行计划的Cost SQL语句:是对数据库(数据) ...

  9. linux 查看网络流量命令

    转: linux 查看网络流量命令 2019年01月31日 14:22:00 weixin_33894992 阅读数 893   sar命令参数很多,有时间man一下. -n参数很有用,他有6个不同的 ...

  10. CISCN 2019 writeup

    划水做了两个pwn和两个逆向...... 二进制题目备份 Re easyGO Go语言,输入有Please字样,ida搜索sequence of bytes搜please的hex值找到字符串变量,交叉 ...