搜索系统启动主类
/**
* AdSearchApplication for 广告搜索服务启动类
*
* @author Isaac.Zhang | 若初
*/
@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.主类和配置文件
文章路径:
http://kswsj.cn/article/iggocg.html