Search code examples
javaspring-bootspring-propertiesspring-autoconfigurationssl-bundle

Disable ssl bundle locally (override config with null)


I have spring boot application with kafka where ssl configuration I wanna replace with ssl bundle and it's work. But locally I wanna start without ssl.

Problem is in replacing configs with null. How to do it?

  spring: 
   ssl:
    bundle:
      jks:
        mybundle:
          key:
            alias: ${MY_ALIAS}
          keystore:
            location: file:${MY_KEYFILE}
            password: ${MY_KEYPASSWORD}
            type: JKS
          trustore:
            location: file:${JAVA_KEYSTORE}
            password: ${JAVA_KEYSTORE_PWD}
            type: JKS
  kafka:
    security:
      protocol: SSL
    ssl:
      bundle: mybundle

so, when in application-local.yaml I try to replace these values with null, but it doesn't work.

let's take last part:

spring:
  kafka:
    security:
      protocol: PLAINTEXT
    ssl:
      bundle:

or

  ssl:
    bundle: null

so after start in my kafkaProperties bundle will be empty string instead of null.

And second part of question is the same. How to replace one of bundle config with null.

  spring: 
   ssl:
    bundle:
      jks: null or [] or {} or #{null}

I can just exclude autoconfiguration of SSL

spring:
  autoconfigure:
    exclude:
      - org.springframework.boot.autoconfigure.ssl.SslAutoConfiguration

but when, it overrides all spring.autoconfigure.exclude from application.yaml file. Not just adding extra one.


Solution

  • Last part of kafka.ssl.bundle is a bug. Fixed after report in spring-boot 3.3.7