From spring
Integrate Spring applications with CredHub for credential reads, writes, generated passwords or certificates, interpolation, and mutual-TLS or OAuth2 authenticated client access. Use this skill when integrating a Spring application with CredHub for credential reads, writes, generated passwords or certificates, interpolation, and mutual-TLS or OAuth2 authenticated client access.
npx claudepluginhub ririnto/sinon --plugin springThis skill uses the workspace's default tool permissions.
Use this skill when integrating a Spring application with CredHub for credential reads, writes, generated passwords or certificates, interpolation, and mutual-TLS or OAuth2 authenticated client access.
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
Use this skill when integrating a Spring application with CredHub for credential reads, writes, generated passwords or certificates, interpolation, and mutual-TLS or OAuth2 authenticated client access.
The current stable Spring CredHub line is 4.0.1. Use the official Spring CredHub starter and keep mutual TLS or OAuth2 selection aligned with the platform's existing CredHub authentication path instead of inventing a second auth mode inside the application.
Use spring-credhub for application-side CredHub client usage, credential naming, typed credential reads, credential generation requests, and secure client configuration.
spring-vault for HashiCorp Vault integration, lease handling, and Vault-specific secret backends.The ordinary Spring CredHub job is:
CredHubOperations by default and switch to ReactiveCredHubOperations only when the surrounding application flow is already reactive.| Situation | Stay here or open a reference |
|---|---|
| Mutual TLS or OAuth2 selection for an ordinary service boundary | Stay in SKILL.md |
| Startup or off-request OAuth2 token acquisition is the blocker | Open references/auth-and-credential-variants.md |
| The application flow is fully reactive | Open references/reactive-access.md |
| Interpolation, certificate generation, permissions, or less-common credential families are the blocker | Open references/advanced-credential-patterns.md |
Use the Spring CredHub starter for ordinary Boot-based integration.
<dependencies>
<dependency>
<groupId>org.springframework.credhub</groupId>
<artifactId>spring-credhub-starter</artifactId>
<version>4.0.1</version>
</dependency>
</dependencies>
./mvnw test -Dtest=DatabaseCredentialServiceTests
./gradlew test --tests DatabaseCredentialServiceTests
spring:
credhub:
url: https://credhub.example.com:8844
tls:
enabled: true
key-store: classpath:credhub-client.p12
key-store-password: ${CREDHUB_KEYSTORE_PASSWORD}
trust-store: classpath:credhub-truststore.p12
trust-store-password: ${CREDHUB_TRUSTSTORE_PASSWORD}
spring:
credhub:
url: https://credhub.example.com:8844
oauth2:
registration-id: credhub-client
Prefer one authentication path per application profile so startup behavior stays predictable.
/app/{env}/db/password before writing any client code.CredHubOperations into a narrow service layer by default, and use ReactiveCredHubOperations only when the application flow is already reactive end to end.@Service
class DatabaseCredentialService {
private final CredHubOperations credHub;
DatabaseCredentialService(CredHubOperations credHub) {
this.credHub = credHub;
}
String password() {
return credHub.credentials()
.getByName(new SimpleCredentialName("/app/prod/db-password"), PasswordCredential.class)
.getValue().getPassword();
}
}
@Service
class MessagingCredentialService {
private final CredHubOperations credHub;
MessagingCredentialService(CredHubOperations credHub) {
this.credHub = credHub;
}
JsonCredential credentials() {
return credHub.credentials()
.getByName(new SimpleCredentialName("/app/prod/messaging"), JsonCredential.class)
.getValue();
}
}
@Service
class FeatureFlagWriter {
private final CredHubOperations credHub;
FeatureFlagWriter(CredHubOperations credHub) {
this.credHub = credHub;
}
void writeFlag(String environment, String value) {
credHub.credentials().set(new SimpleCredentialName("/app/%s/feature-flag".formatted(environment)), new ValueCredential(value));
}
}
@Service
class PasswordGenerationService {
private final CredHubOperations credHub;
PasswordGenerationService(CredHubOperations credHub) {
this.credHub = credHub;
}
void generateDatabasePassword() {
credHub.credentials().generatePassword(new SimpleCredentialName("/app/prod/db-password"));
}
}
@SpringBootTest
class DatabaseCredentialServiceTests {
@Autowired
DatabaseCredentialService service;
@Test
void passwordReturnsValueFromCredHub() {
String password = service.password();
assertAll(
() -> assertNotNull(password),
() -> assertFalse(password.isEmpty())
);
}
}
/app/{environment}/{service}/{credential-name}
PasswordCredential credential = credHub.credentials()
.getByName(new SimpleCredentialName("/app/prod/db-password"), PasswordCredential.class)
.getValue();
{
"username": "app",
"password": "secret",
"host": "db.example.com",
"port": 5432
}
Return:
assertAll(...) when one test checks multiple properties of the same credential read.ReactiveCredHubOperations.