溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

[Spring cloud 一步步實現(xiàn)廣告系統(tǒng)] 9. 主類和配置文件

發(fā)布時間:2020-08-01 11:32:51 來源:網絡 閱讀:330 作者:zhangpan0614 欄目:編程語言
搜索系統(tǒng)啟動主類
/**
 * AdSearchApplication for 廣告搜索服務啟動類
 *
 * @author <a href="mailto:magicianisaac@gmail.com">Isaac.Zhang | 若初</a>
 */
@EnableFeignClients  //啟動Feign 客戶端,為了訪問其他微服務
@EnableDiscoveryClient // 開啟服務發(fā)現(xiàn)組件,在這里等同于 @EnableEurekaClient
@EnableHystrix // 開啟hystrix 斷路器
@EnableCircuitBreaker // 斷路器
@EnableHystrixDashboard // 開啟hystrix 監(jiān)控
@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 #執(zhí)行時是否打印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 #最大連接數(shù)
      min-idle: 2 #最小空閑連接數(shù)
      initial-size: 2 #默認初始化連接數(shù)
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問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。

AI