[Springcloud一步步实现广告系统]9.主类和配置文件

搜索系统启动主类
/**
 * AdSearchApplication for 广告搜索服务启动类
 *
 * @author <a href="mailto:magicianisaac@gmail.com">Isaac.Zhang | 若初</a>
 */
@EnableFeignClients  //启动Feign 客户端,为了访问其他微服务
@EnableDiscoveryClient // 开启服务发现组件,在这里等同于 @EnableEurekaClient
@EnableHystrix // 开启hystrix 断路器
@EnableCircuitBreaker // 断路器
@EnableHystrixDashboard // 开启hystrix 监控
@SpringBootApplication
public class AdSearchApplication {
    public static void main(String[] args) {
        SpringApplication.run(AdSearchApplication.class, args);
    }
}
配置文件
server:
  port: 7001
  servlet:
    context-path: /ad-search #http请求的根路径(请求前缀,在handle的mapping之前,需要127.0.0.1/ad-search/XXXX)
spring:
  application:
    name: mscx-ad-search
  jpa:
    show-sql: true #执行时是否打印sql语句,方便调试
    hibernate:
      ddl-auto: none
    properties:
      hibernate.format_sql: true
    open-in-view: false #控制是否在懒加载时,有可能会找不到bean报错
  datasource:
    username: root
    url: jdbc:MySQL://127.0.0.1:3306/advertisement?useSSL=false&autoReconnect=true
    password: ****
    tomcat:
      max-active: 4 #最大连接数
      min-idle: 2 #最小空闲连接数
      initial-size: 2 #默认初始化连接数
eureka:
  client:
    service-url:
      defaultZone: http://server1:7777/eureka/,http://server2:8888/eureka/,http://server3:9999/eureka/
feign:
  hystrix:
    enabled: true
management:
  endpoints:
    web:
      exposure:
        include: "*"

adconf:
  mysql:
    host: 127.0.0.1
    port: 3306
    username: root
    password: ****
    binlogName: ""
    position: -1
  kafka:
    topic: ad-search-mysql-data

当前名称:[Springcloud一步步实现广告系统]9.主类和配置文件
当前URL:https://www.cdcxhl.com/article26/iggocg.html

成都网站建设公司_创新互联,为您提供品牌网站设计外贸建站网站内链网站设计公司电子商务搜索引擎优化

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

外贸网站建设