基于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. docker 部署 .net core

    1.centos安装好sdk2.1,安装好docker,这些基本的操作就不赘述. 2.准备好core项目,版本2.1 3.新建dockerfile文件放到项目发布文件夹里,里面内容如下: FROM m ...

  2. Mac 下 brew的卸载 插件

    brew 又叫 Homebrew,是 Mac OSX 上的软件包管理工具,能在 Mac 命令行中方便的安装软件或者卸载软件, 只需要一个命令, 非常方便 brew 类似 ubuntu 系统下的 apt ...

  3. Promise初尝试

    promise.ts export function showAlert() { console.log("开始调用showAlert"); return new Promise( ...

  4. win10windows无法创建快捷方式 请检查磁盘

      这个是因为文件没有权限造成的   打开"我的电脑",菜单栏里选择"工具"-"文件夹选项"-"查看",把里面" ...

  5. FYI是什么意思?

    FYI是For Your Information的缩写,英语解释为:提供给您的信息,供您参考,是当前在外企中流行的英文缩写,为工作用语,常用于工作的电子邮件中.     文章来源:刘俊涛的博客 欢迎关 ...

  6. SQL-W3School-高级:SQL FULL JOIN 关键字

    ylbtech-SQL-W3School-高级:SQL FULL JOIN 关键字 1.返回顶部 1. SQL FULL JOIN 关键字 只要其中某个表存在匹配,FULL JOIN 关键字就会返回行 ...

  7. kotlin之高阶函数

    高阶函数是一种特殊的函数,它接受函数作为参数,或者返回一个函数 import java.awt.geom.Area fun main(arg: Array<String>) { val m ...

  8. Object.keys() 遍历对象

    Object.keys()方法的运用与数组遍历 Object.keys()用于获得由对象属性名组成的数组,可与数组遍历相结合使用,用起来效果杠杠滴.数组遍历可以用for()或forEach()来实现, ...

  9. SpringBoot: 10.整合mybatis(转)

    需求:通过使用 SpringBoot+SpringMVC+MyBatis 整合实现一个对数据库中的 t_user 表的 CRUD 的操作 1.创建maven项目,添加项目所需依赖 <!--spr ...

  10. CSS - clearfix清除浮动

    首先,我们来解释一下为什么要使用 clearfix(清除浮动). 通常我们在写html+css的时候,如果一个父级元素内部的子元素是浮动的(float),那么常会发生父元素不能被子元素正常撑开的情况, ...