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
If I create a bean with a property of type java.net.URI, and try to initialize it in an XML bean definition file, I'm unable to define a URI instance with a fragment in it.
For example, consider the following bean definition
I apply this bean definition using the following test program:
import java.net.URI;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
public class TestInitURI {
private String uriSpec;
private URI uri;
public void setUri(URI uri) { this.uri = uri; }
public void setUriSpec(String uriSpec) { this.uriSpec = uriSpec; }
public static void main(String[] args) {
BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("beans.xml"));
TestInitURI bean = beanFactory.getBean(TestInitURI.class);
show("Bean property", bean.uri);
show("Expected ", URI.create(bean.uriSpec));
}
private static void show(String prefix, URI uri) {
System.out.println(prefix + " URI " + uri + " (host=" + uri.getHost() + ", authority=" + uri.getAuthority() + ", path="
+ uri.getPath() + ", fragment=" + uri.getFragment() + ")");
}
}
The output is the following:
Bean property URI env://server%233 (host=null, authority=server#3, path=, fragment=null)
Expected URI env://server#3 (host=server, authority=server, path=, fragment=3)
In other words, I would expect that defining a URI property in an XML bean definition file with a string constant is equivalent to initializing that property with a URI created by invoking URI.create(String) with the same string constant.
Olav Reinert opened SPR-7083 and commented
If I create a bean with a property of type
java.net.URI
, and try to initialize it in an XML bean definition file, I'm unable to define a URI instance with a fragment in it.For example, consider the following bean definition
I apply this bean definition using the following test program:
The output is the following:
In other words, I would expect that defining a URI property in an XML bean definition file with a string constant is equivalent to initializing that property with a URI created by invoking
URI.create(String)
with the same string constant.Affects: 3.0.2
Issue Links:
Referenced from: commits 03120b7
The text was updated successfully, but these errors were encountered: