springcloud--商城项目的启动类and配置文件
2019-01-03 11:48
465 查看
目录
eureka的配置文件
[code]server: port: 10086 #eureka端口号 spring: application: name: eureka-web-server #eureka服务的名字 eureka: server: enable-self-preservation: false # Eureka自我保护机制,true打开/false禁用,默认打开状态,建议生产环境打开此配置。 eviction-interval-timer-in-ms: 5000 # 修改检查失效服务的时间 client: fetch-registry: false # 定期的更新客户端的服务清单,以保证服务访问的正确性 register-with-eureka: false # 是否将自己注册为服务 service-url: defaultZone: http://127.0.0.1:10086/eureka # eureka服务的开放地址
创建运行主函数
网关的配置文件
网关配置文件
[code]server: port: 9999 #服务端口 spring: application: name: api-gateway #指定服务名 zuul: routes: user-service: # 这里是路由id,随意写 path: /user/** # 这里是映射路径 #url: http://127.0.0.1:8081 # 映射路径对应的实际url地址 serviceId: web-service #服务的名称 retryable: true eureka: client: registry-fetch-interval-seconds: 5 # 获取服务列表的周期:5s service-url: defaultZone: http://127.0.0.1:10086/eureka instance: prefer-ip-address: true ip-address: 127.0.0.1 ribbon: ConnectTimeout: 250 # 连接超时时间(ms) ReadTimeout: 2000 # 通信超时时间(ms) OkToRetryOnAllOperations: true # 是否对所有操作重试 MaxAutoRetriesNextServer: 2 # 同一服务不同实例的重试次数 MaxAutoRetries: 1 # 同一实例的重试次数 hystrix: command: default: execution: isolation: thread: timeoutInMillisecond: 6000 # 熔断超时时长:6000ms
网关的启动类(网关其实就是以前的消费者、调用者)
服务的配置文件
[code]server: port: 9093 spring: application: name: web-service datasource: url: jdbc:mysql://127.0.0.1:3306/jmyp_db?useUnicode=true&characterEncoding=utf8&autoReconnect=true&allowMultiQueries=true username: root password: admin driver-class-name: com.mysql.jdbc.Driver druid: initial-size: 5 min-idle: 5 max-active: 20 max-wait: 1000 test-on-borrow: true servlet: multipart: max-file-size: 5MB # security: # user: # name: admin # password: admin eureka: client: service-url: defaultZone: http://127.0.0.1:10086/eureka instance: prefer-ip-address: true ip-address: 127.0.0.1 instance-id: ${eureka.instance.ip-address}.${server.port} lease-renewal-interval-in-seconds: 3 lease-expiration-duration-in-seconds: 10 mybatis: type-aliases-package: com.jmyp.pojo mapper: not-empty: false identity: mysql
写服务提供者的启动类
相关文章推荐
- Tomcat启动项目时加载了两遍Spring配置文件
- Spring Cloud 本地项目从远程服务中心抓取配置文件
- 配置spring文件时项目启动不了--cvc-elt.1: Cannot find the declaration of element 'beans'.
- Springboot 项目pom.xml 配置文件以及启动类的一些配置
- Java opencsv--使用 Spring 的 PostConstruct机制,项目启动时,将CSV配置文件读取到内存 map 中
- Spring Web项目spring配置文件随服务器启动时自动加载
- 项目启动时,提示spring配置文件未知的utf-8编码
- Spring配置文件xsi:schemaLocation无法解析导致启动失败的解决方案
- 通过环境变量设置WEB项目数据源(Spring)及其项目配置文件路径,动态更新数据源及项目配置
- 通过环境变量设置WEB项目数据源(Spring)及其项目配置文件路径,动态更新数据源及项目配置
- spring 集成的项目,Properties配置文件外移
- Spring配置文件异常:White spaces are required between publicId and systemId
- Maven配置Spring Boot项目打包,依赖包到lib目录、配置文件到conf目录
- 使用Gradle构建SpringBoot工程系列:第四篇:项目初始化(编辑build.gradle文件,引入项目基本配置及依赖)
- log4j无日志生成? 我将一个web项目部署在tomcat server.xml配置文件中,当我启动tomcat是无日志输出。
- Atitit. 软件GUI按钮与仪表盘--web服务器区--获取apache配置文件路径 linux and apache的启动、停止、重启
- SpringMVC异常总结:启动tomcat时出错,无法正取加载spring配置文件
- 使用maven给spring项目打可直接运行的jar包(配置文件内置外置的打法)
- springboot 修改启动时默认加载application.properties文件以及加载指定配置文件
- 基于spring的web项目中一些配置文件的解释