spring-cloud-vault: 'Scheme' Configuration option is not recognized when starting up spring boot application

Describe the bug I am running vault in a local docker container at http://localhost:8200 and have configured my application to reach out to this container using http, NOT https. However, I see this error when starting up the application: I/O error on GET request for "https://localhost:8200/v1/secret/application/local": Unsupported or unrecognized SSL message

I will post my configuration file and my docker-compose file below.

I am using the following dependency in my gradle build: implementation("org.springframework.cloud:spring-cloud-starter-vault-config")

From the error message it looks like spring-cloud-vault-config-4.0.1 and spring-vault-core-3.0.0 are being brought in as transitive dependencies.

Also, I am running this locally using the local profile

Sample application-local.yml:

spring:
  application:
    name: "Generic Service"

  cloud.vault:
    scheme: http
    enabled: false
    token: 00000000-0000-0000-0000-000000000000
    uri: http://localhost:8200
    ssl:
      trust-store: none
  sql:
    init:
      mode: always
  datasource:
    url: jdbc:postgresql://localhost:5432/postgres
    username: postgres
    password: postgres
    driver-class-name: org.postgresql.Driver

  kafka:
    bootstrap-servers: localhost:29092
    template:
      default-topic: my-topic
    consumer:
      group-id: generic-group
      auto-offset-reset: earliest
logging:
  level:
    root: INFO

docker-compose.yml:

services:
  vault:
    image: artifactory.legalzoom.com/docker-remote/hashicorp/vault:1.13
    restart: always
    command: [ 'vault', 'server', '-dev', '-dev-listen-address=0.0.0.0:8200' ]
    environment:
      VAULT_DEV_ROOT_TOKEN_ID: "00000000-0000-0000-0000-000000000000"
    ports:
      - "8200:8200"
  db:
    image: postgres:14.1-alpine
    restart: always
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    ports:
      - '5432:5432'
    volumes:
      - db:/var/lib/postgresql/data
  zookeeper:
    image: confluentinc/cp-zookeeper:latest
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000
    ports:
      - 22181:2181
  kafka:
    image: confluentinc/cp-kafka:latest
    depends_on:
      - zookeeper
    ports:
      - 29092:29092
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
volumes:
  db:
    driver: local
networks:
  br:
    driver: bridge

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

I figured out the issue! I should have been putting my settings in a bootstrap.yml file as the settings need to be loaded before the application starts up. Sorry for any confusion this may have caused!

There’s a thread on profile-specific config files in the Boot issue tracker: https://github.com/spring-projects/spring-boot/issues/26858