У меня есть приложение Spring Boot JPA, регистрирующее себя как микросервис с помощью Consul:
@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
Однако, когда Consul связывается с конечной точкой /health
, в моем приложении возникает следующее SQLException
:
«Хосту 172.17.0.1 не разрешено подключаться к этому серверу MySQL».
Что происходит и почему есть даже попытка подключения?