### Question:
Jaxb2RootElementHttpMessageConverter extends AbstractJaxb2HttpMessageConverter<Object> { public void setProcessExternalEntities(boolean processExternalEntities) { this.processExternalEntities = processExternalEntities; }  void setProcessExternalEntities(boolean processExternalEntities); boolean isProcessExternalEntities(); @Override boolean canRead(Class<?> clazz, MediaType mediaType); @Override boolean canWrite(Class<?> clazz, MediaType mediaType);  }### Answer:
@Test public void readXmlRootElementExternalEntityEnabled() throws Exception { Resource external = new ClassPathResource("external.txt", getClass()); String content = "<!DOCTYPE root [" + " <!ELEMENT external ANY >\n" + " <!ENTITY ext SYSTEM \"" + external.getURI() + "\" >]>" + " <rootElement><external>&ext;</external></rootElement>"; MockHttpInputMessage inputMessage = new MockHttpInputMessage(content.getBytes("UTF-8")); this.converter.setProcessExternalEntities(true); RootElement rootElement = (RootElement) converter.read(RootElement.class, inputMessage); assertEquals("Foo Bar", rootElement.external); }