diff --git a/xstream/src/main/java/com/baeldung/initializer/SimpleXstreamInitializer.java b/xstream/src/main/java/com/baeldung/initializer/SimpleXstreamInitializer.java index c631726eb3..a391b0dca0 100644 --- a/xstream/src/main/java/com/baeldung/initializer/SimpleXstreamInitializer.java +++ b/xstream/src/main/java/com/baeldung/initializer/SimpleXstreamInitializer.java @@ -15,10 +15,18 @@ public class SimpleXstreamInitializer { } public XStream getXstreamJettisonMappedInstance() { - return new XStream(new JettisonMappedXmlDriver()); + XStream xstream = new XStream(new JettisonMappedXmlDriver()); + xstream.allowTypesByWildcard(new String[]{ + "com.baeldung.**" + }); + return xstream; } public XStream getXstreamJsonHierarchicalInstance() { - return new XStream(new JsonHierarchicalStreamDriver()); + XStream xstream = new XStream(new JsonHierarchicalStreamDriver()); + xstream.allowTypesByWildcard(new String[]{ + "com.baeldung.**" + }); + return xstream; } } \ No newline at end of file