Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

ConsulConfigProperties#getAclToken() remains null although spring.cloud.consul.token is available in the Environment

Aperta
#996 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
java, spring-boot
Ambito
backend, cloud

Direzione di ricerca

Inizia con ConsulConfigProperties e il campo aclToken mostrato nell’issue, quindi traccia come viene risolta l’espressione @Value quando la proprietà proviene da una sorgente ConfigData Vault. Confronta questo percorso con Environment.getProperty e la normale iniezione @Value; il lavoro è completato quando è stato stabilito se il valore null è previsto oppure è stata riprodotta una regressione con una copertura mirata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

waiting-for-triage

Description

I'm investigating the behavior of ConsulConfigProperties#getAclToken() in Spring Cloud Consul and I'm not sure whether this is an intended behavior or a bug.

In my application, spring.cloud.consul.token is successfully loaded from Spring Cloud Vault through ConfigData.

The property is available in the Environment, and a regular @Value("${spring.cloud.consul.token}") injection works correctly.

However, ConsulConfigProperties#getAclToken() always returns null.

Versions

  • Spring Boot: 3.5.14
  • Spring Cloud Release Train: 2025.0.1
  • spring-cloud-consul-config: 4.3.1

Configuration

spring:
  config:
    import:
      - vault://
      - consul://

  cloud:
    consul:
      config:
        enabled: true

The Consul ACL token is stored in Vault under:

spring.cloud.consul.token

Observations

The following values are logged during application startup:

Environment.getProperty("spring.cloud.consul.token")
=> 08****35 (masked intentionally)

ConsulConfigProperties#getAclToken()
=> null

The property source owning the property is:

dev-secret/consul-configs

Additional verification

To make sure this was not a configuration issue, I performed the following checks:

  • Environment.getProperty("spring.cloud.consul.token") returns the expected value.
  • A regular Spring bean using
@Value("${spring.cloud.consul.token}")
private String token;

receives the correct value.

  • ConsulConfigProperties itself is properly bound:

    • enabled
    • defaultContext
    • prefixes

    all contain the expected values.

  • Using reflection confirms that the internal aclToken field is still null.

Field field = ConsulConfigProperties.class.getDeclaredField("aclToken");
field.setAccessible(true);

System.out.println(field.get(consulConfigProperties));
// null

The field is annotated with:

@Value("${consul.token:${CONSUL_TOKEN:${spring.cloud.consul.token:${SPRING_CLOUD_CONSUL_TOKEN:}}}}")
private String aclToken;

and the annotation is present at runtime.

Question

Is this expected?

Should ConsulConfigProperties#getAclToken() be populated from spring.cloud.consul.token, or is the aclToken field intentionally left unset when using ConfigData (Vault)?

If it is expected to be populated, this appears to be a regression because:

  • the property exists in the Environment,
  • @Value works on regular Spring beans,
  • only the aclToken field inside ConsulConfigProperties remains null.
Lingua principale
Java
Stelle
821
Fork
539
Merge medio
5h 34m
PR unite (30g)
13

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di spring-cloud/spring-cloud-consul

Tutte le issue di spring-cloud/spring-cloud-consul

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.