The issue can be reproduced with WAR files using the following naming scheme:
The foo#bar.war name is required when you want to achieve a deep context path value like /foo/bar.
The ServletContextResourcePatternResolver and the UrlResource implementation which is used internally do not provide any handling for special characters like #. This leads to a MalformedURLException.
The private doRetrieveMatchingJarEntries method of the ServletContextResourcePatternResolver cannot be overridden and the only workaround at the moment is to duplicate the whole class logic in a custom implementation. A simple encoding of the special character fixes the issue.