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>2.3.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>5.3.23</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>5.7.5</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-oauth2-client</artifactId>
            <version>5.7.5</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:2.3.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:5.3.23")
    }

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:5.7.5")
        compile("org.springframework.security:spring-security-oauth2-client:5.7.5")
    }