Before adding, my Jersey configuration in configureServlets method looked like this (taken from here):
serve("/api/*").with(GuiceContainer.class, ImmutableMap.of(JSONConfiguration.FEATURE_POJO_MAPPING, "true"));
After:
Mapparameters = new HashMap (); parameters.put(JSONConfiguration.FEATURE_POJO_MAPPING, "true"); parameters.put("com.sun.jersey.config.property.packages", "com.examle.api"); serve("/api/*").with(GuiceContainer.class, parameters);
A more robust version without hardcoded values:
... parameters.put(PackagesResourceConfig.PROPERTY_PACKAGES, com.examle.api.AnyResource.class.getPackage().getName()); ...
No comments:
Post a Comment