Spring / Spring CredHub Interview questions
What is the difference between getByName and getByNameWithHistory?
getByName() returns only the current value of a credential — a single CredentialDetails<T> — which is what most application code wants when it just needs to use the secret right now.
getByNameWithHistory() returns a List<CredentialDetails<T>> covering every stored version of that credential name, including ones that have since been overwritten by later writes or regenerations. An overload also accepts a version count, so you can limit how many historical entries come back.
History is mainly useful for auditing or for rotation logic that needs to briefly know a credential's previous value — for example, to accept both the old and new database password during a rolling restart.
More Related questions...