SpringBoot 2.1.9 -> 2.2.0 - конечная точка работоспособности больше не работает - PullRequest
1 голос
/ 02 ноября 2019

Попытка обновления до Spring 2.2.0 и моя конечная точка /health больше не работают, что вызывает проблемы с моей проверкой работоспособности AWS ALB.

Почему моя конечная точка работоспособности не работает сейчас?

Релевантный application.properties:

# specifies that actuator endpoints be published on separate port
management.server.port=8081

# spring boot 2 moved this under "/actuator" but I don't like it, so this
management.endpoints.web.base-path=/

# This makes the /health endpoint return "status:UP" when the
# DB cannot be reached.
# Without this, overall status depends on datasource status.
#
# This is needed on the AWS side because ELB healthchecks used for ASG, so
# when DB became unreachable (because of RDS maintenance or other stuff-ups) or
# was just not reliably reachable (becaue of load testing resulting in
# connection pool exhaustion) - the ASG would start cycling instances
# unnecessarily.
management.health.defaults.enabled = false

Релевантная конфигурация Spring:

public static String[] anonymousUrlPatterns(){
  return new String[] {
    // unauthenticated so the ELB can call it
    HEALTH_URL,
    // unauthenticated because that's what browsers do
    FAV_ICON_URL,
    ...
  }
}


private void configureEndpointRoles(HttpSecurity http) throws Exception{
  http.authorizeRequests().
    antMatchers(anonymousUrlPatterns()).permitAll().
    ...
    anyRequest().denyAll()
  ;
}

@Override
protected void configure(HttpSecurity http) throws Exception{
  this.configureSsl(http);

  this.configureEndpointRoles(http);

  http.csrf().disable();

  http.sessionManagement().sessionCreationPolicy(STATELESS);

  http.httpBasic().disable();

  http.cors();

  this.configureExceptionHandling(http);

  ...

}

Это команда, которую я использую для проверки на локальном компьютере:

curl -v http://localhost:8081/health

На 2.1.9 скручивание возвращает {"status":"UP"} - на 2.2.0 я не получаю ответа.

1 Ответ

0 голосов
/ 02 ноября 2019

Оказывается, это было вызвано management.health.defaults.enabled = false

. Сотрудники Spring снова возились с конечными точками привода, и теперь состояние базы данных не отображается как часть состояния работоспособности. больше.

В то же время кажется, что они изменили настройку, чтобы теперь означать «полностью отключить конечную точку работоспособности».

И для бонусных баллов, хотя статус БД больше не отображает как часть конечной точки /health, он регрессирует и теперь сообщает об ошибке DOWN, если БД недоступна.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...