Libraries such as Jasypt and similar Metric wrappers might create delegate for each Environment.propertySource - In this case the down cast fails to resolve like this :
Caused by: java.lang.ClassCastException: Cannot cast com.ulisesbocchio.jasyptspringboot.wrapper.EncryptablePropertySourceWrapper to org.springframework.boot.env.RandomValuePropertySource
at java.base/java.lang.Class.cast(Class.java:3605)
at org.springframework.cloud.util.random.CachedRandomPropertySourceAutoConfiguration.initialize(CachedRandomPropertySourceAutoConfiguration.java:44)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...
Since that PropertySource relies on conventions around getProperty calls, we don't need the specific type to be passed.