1. Getting started

Spring CredHub supports CredHub server version 1.x and 2.x. This library is intended to provide full coverage of the CredHub API - all operations on all credential types.spring-doc.cn

Spring CredHub has been optimized to work with Spring Boot applications. To include Spring CredHub in a Spring Boot application, add some dependencies to the project build file.spring-doc.cn

1.1. Maven Dependencies

Add the Spring CredHub starter to the dependencies section of the build file:spring-doc.cn

    <dependencies>
        <dependency>
            <groupId>org.springframework.credhub</groupId>
            <artifactId>spring-credhub-starter</artifactId>
            <version>3.0.0</version>
        </dependency>
    </dependencies>

To enable reactive support in Spring CredHub, add the following Spring WebFlux dependency to the build file:spring-doc.cn

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
            <version>3.0.2</version>
        </dependency>
    </dependencies>

To use OAuth2 authentication to CredHub, add the following Spring Security dependencies to the build file:spring-doc.cn

    <dependencies>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>6.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-oauth2-client</artifactId>
            <version>6.0.1</version>
        </dependency>
    </dependencies>

1.2. Gradle Dependencies

Add the Spring CredHub starter to the dependencies section of the build file:spring-doc.cn

    dependencies {
        compile('org.springframework.credhub:spring-credhub-starter:3.0.0')
    }

To enable reactive support in Spring CredHub, add the following Spring WebFlux dependency to the build file:spring-doc.cn

    dependencies {
        compile("org.springframework.boot:spring-boot-starter-webflux:3.0.2")
    }

To use OAuth2 authentication to CredHub, add the following Spring Security dependencies to the build file:spring-doc.cn

    dependencies {
        compile("org.springframework.security:spring-security-config:6.0.1")
        compile("org.springframework.security:spring-security-oauth2-client:6.0.1")
    }