温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

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

发布时间:2020-08-01 11:32:51 来源:网络 阅读:323 作者:zhangpan0614 栏目:编程语言
搜索系统启动主类
/**
 * 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
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI