My Tomcat installation has a space character in the path (installation is provided so I cannot change this). I want to configure my EhCache via JCacheManagerFactoryBean, property cacheManagerUri=classpath:ehcache.xml. The resource URL yields something like ...%20... which is the correct encoding of the space character, but then the default URIEncoder (which is "encoding" by default) encodes the percent sign and I end up with a URI like ...%2520... which does not work for obvious reasons. I do not understand why the URIEditor needs to "encode" at all, looks like fixing broken URIs at the wrong place, but at least for the case of classpath: URI's I absolutely do not see a point in applying any additional encoding. The resource gives a valid URL and this is just fine as it is.
I suggest to replace the createURI(url) in URIEditor:110 by a simple new URI(url). Running such patch fixes the issue for me.
Affects: 4.3.14, 5.0.4
#10673 org.springframework.beans.propertyeditors.URIEditor does double escaping for % signes for URIs that contain a schema
#11743 Unable to inject a URI with a fragment as a bean property value
Good catch, URIEditor is quite outdated there: For classpath URLs, it should use ClassPathResource.getURI() directly, not even going via getURL().toString() and then parsing the String into a URI instance again. The encoding step is only meant to be applied to user-specified values to begin with, not to system-obtained ones.