Class SecretManagerConfigDataLocationResolver

java.lang.Object
com.google.cloud.spring.autoconfigure.secretmanager.SecretManagerConfigDataLocationResolver
All Implemented Interfaces:
org.springframework.boot.context.config.ConfigDataLocationResolver<SecretManagerConfigDataResource>

public class SecretManagerConfigDataLocationResolver extends Object implements org.springframework.boot.context.config.ConfigDataLocationResolver<SecretManagerConfigDataResource>
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    isResolvable(org.springframework.boot.context.config.ConfigDataLocationResolverContext context, org.springframework.boot.context.config.ConfigDataLocation location)
    Checks if the property can be resolved by the Secret Manager resolver.
    resolve(org.springframework.boot.context.config.ConfigDataLocationResolverContext context, org.springframework.boot.context.config.ConfigDataLocation location)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.springframework.boot.context.config.ConfigDataLocationResolver

    resolveProfileSpecific
  • Constructor Details

    • SecretManagerConfigDataLocationResolver

      public SecretManagerConfigDataLocationResolver()
  • Method Details

    • isResolvable

      public boolean isResolvable(org.springframework.boot.context.config.ConfigDataLocationResolverContext context, org.springframework.boot.context.config.ConfigDataLocation location)
      Checks if the property can be resolved by the Secret Manager resolver. For the check, we rely on the presence of the SecretManagerSyntaxUtils class, which is an optional dependency. Since optional dependencies may not be present at runtime, we explicitly check for its existence before resolving the property. If it's not present, it means this config resolver is not meant to be used.
      Specified by:
      isResolvable in interface org.springframework.boot.context.config.ConfigDataLocationResolver<SecretManagerConfigDataResource>
      Returns:
      true if it contains the expected `sm@` or `sm://` prefix, false otherwise.
    • resolve

      public List<SecretManagerConfigDataResource> resolve(org.springframework.boot.context.config.ConfigDataLocationResolverContext context, org.springframework.boot.context.config.ConfigDataLocation location) throws org.springframework.boot.context.config.ConfigDataLocationNotFoundException, org.springframework.boot.context.config.ConfigDataResourceNotFoundException
      Specified by:
      resolve in interface org.springframework.boot.context.config.ConfigDataLocationResolver<SecretManagerConfigDataResource>
      Throws:
      org.springframework.boot.context.config.ConfigDataLocationNotFoundException
      org.springframework.boot.context.config.ConfigDataResourceNotFoundException