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.1-SNAPSHOT</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>{spring-boot-version}</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>{spring-security-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-oauth2-client</artifactId>
            <version>{spring-security-version}</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.1-SNAPSHOT')
    }

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:{spring-boot-version}")
    }

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