1
我有一個春天啓動JPA申請註冊自己爲一個領事的microService:爲什麼領事嘗試連接到我的數據庫?
@SpringBootApplication
@EnableDiscoveryClient
@EnableAutoConfiguration
public class Bootstrapper {
public static void main(String[] args) {
SpringApplication.run(Bootstrapper.class, args);
}
}
我application.yml看起來是這樣的:
spring:
datasource:
url: jdbc:mysql://localhost:3306/butler_test
username: root
password: pwd
driver-class-name: com.mysql.jdbc.Driver
jpa:
hibernate:
ddl-auto: create
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
show-sql: false
spring:
cloud:
consul:
discovery:
healthCheckPath: /health
healthCheckInterval: 10s
然而,當領事接觸/health
端點,以下SQLException
引發我的申請:
「主機'172.17.0.1'不允許連接到此MySQL服務器」。
這是怎麼回事,爲什麼還會有連接嘗試?