You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A runnable sample on JDoodle does not exhibit the behavior, as that seems to be using Gradle under the hood, which might be able to resolve the optional dependency. This is also probably why the project's unit tests pass.
However, a runnable sample on Scastie does exhibit the behavior. It is Scala, but the one-liner code is not important, what is important is that it only uses the pom declaration.
Reacted by Gaël Jourdan-Weil, aka-mgillette, Alexander Suter, Kishore Purushothaman and Christian
We ran into this issue today.
A quick peek in the code of AbstractValidatingPasswordEncoder 7.1.0 shows imports of 2 classes from spring-core
org.springframework.lang.Contract
org.springframework.util.StringUtils
Maven gives no indication that spring-crypto has any dependencies.
The online documentation for Spring Security starts with: "The Spring Security Crypto module provides support for symmetric encryption, key generation, and password encoding. The code is distributed as part of the core module but has no dependencies on any other Spring Security (or Spring) code."
Thanks for the detailed report and repro (@bursauxa) and the confirmations (@aka-mgillette, @mschorsch, @FlyingSheepOnSailfish, @alexsuter, @kpur-sbab) — this looks like a genuine regression introduced when AbstractValidatingPasswordEncoder started using org.springframework.util.StringUtils/org.springframework.lang.Contract (spring-core) without spring-core becoming a non-optional dependency of spring-security-crypto's published POM.
Since the crypto module's docs explicitly promise "no dependencies on any other Spring Security (or Spring) code," there seem to be two possible fix directions:
Remove the new spring-core imports from AbstractValidatingPasswordEncoder (inline the equivalent null/empty checks), preserving the documented zero-dependency contract.
Make spring-core a required (non-optional) dependency in the Gradle build so the published POM declares it.
Direction 1 seems more in line with the documented contract and has no downstream footprint, but I wanted to check preference before submitting a PR — happy to implement whichever direction you'd prefer (or hold off if this is already being tracked internally).
@alexsuter That's the direction I went with — #19341 does exactly that.
It removes the two org.springframework.util.StringUtils#hasLength calls that AbstractValidatingPasswordEncoder picked up in 7.1.0 and replaces them with plain JDK null/empty checks — a three-line diff in that one file, marked Closes gh-19317. So spring-security-crypto gains no dependency and keeps the documented "no dependencies on any other Spring Security (or Spring) code" contract. That's direction 1 of the two I listed above, rather than promoting spring-core to a required dependency in the published POM.
CI is green on it; it's waiting on maintainer review.
Activity
aka-mgillette commentedon Jun 11, 2026
I'm seeing this in AbstractValidatingPasswordEncoder instead of AbstractPasswordEncoder - maybe a typo? Looking forward to any resolution as well.
bursauxa commentedon Jun 12, 2026
You are correct @aka-mgillette - I updated my post.
(the quoted code was from the correct place!)
mschorsch commentedon Jun 18, 2026
+1
FlyingSheepOnSailfish commentedon Jun 26, 2026
We ran into this issue today.
A quick peek in the code of
AbstractValidatingPasswordEncoder7.1.0 shows imports of 2 classes from spring-coreMaven gives no indication that spring-crypto has any dependencies.
The online documentation for Spring Security starts with:
"The Spring Security Crypto module provides support for symmetric encryption, key generation, and password encoding. The code is distributed as part of the core module but has no dependencies on any other Spring Security (or Spring) code."
alexsuter commentedon Jul 21, 2026
+1
kpur-sbab commentedon Aug 6, 2026
+1
seonwooj0810 commentedon Aug 12, 2026
Thanks for the detailed report and repro (@bursauxa) and the confirmations (@aka-mgillette, @mschorsch, @FlyingSheepOnSailfish, @alexsuter, @kpur-sbab) — this looks like a genuine regression introduced when
AbstractValidatingPasswordEncoderstarted usingorg.springframework.util.StringUtils/org.springframework.lang.Contract(spring-core) without spring-core becoming a non-optional dependency ofspring-security-crypto's published POM.Since the crypto module's docs explicitly promise "no dependencies on any other Spring Security (or Spring) code," there seem to be two possible fix directions:
AbstractValidatingPasswordEncoder(inline the equivalent null/empty checks), preserving the documented zero-dependency contract.Direction 1 seems more in line with the documented contract and has no downstream footprint, but I wanted to check preference before submitting a PR — happy to implement whichever direction you'd prefer (or hold off if this is already being tracked internally).
bursauxa commentedon Aug 12, 2026
I think your earlier PR is completely fine @seonwooj0810
alexsuter commentedon Aug 19, 2026
@seonwooj0810 It would be nice if spring crypto has no additional dependencies.
seonwooj0810 commentedon Sep 1, 2026
@alexsuter That's the direction I went with — #19341 does exactly that.
It removes the two
org.springframework.util.StringUtils#hasLengthcalls thatAbstractValidatingPasswordEncoderpicked up in 7.1.0 and replaces them with plain JDK null/empty checks — a three-line diff in that one file, markedCloses gh-19317. Sospring-security-cryptogains no dependency and keeps the documented "no dependencies on any other Spring Security (or Spring) code" contract. That's direction 1 of the two I listed above, rather than promoting spring-core to a required dependency in the published POM.CI is green on it; it's waiting on maintainer review.
Avoid spring-core in password encoder validation
Avoid spring-core in password encoder validation