diff --git a/plugins/json/src/main/java/org/apache/struts2/json/JSONInterceptor.java b/plugins/json/src/main/java/org/apache/struts2/json/JSONInterceptor.java index 2c793de42..d3b1b4833 100644 --- a/plugins/json/src/main/java/org/apache/struts2/json/JSONInterceptor.java +++ b/plugins/json/src/main/java/org/apache/struts2/json/JSONInterceptor.java @@ -71,13 +71,6 @@ public class JSONInterceptor extends AbstractInterceptor { private String jsonContentType = "application/json"; private String jsonRpcContentType = "application/json-rpc"; - private JSONUtil jsonUtil; - - @Inject - public void setJsonUtil(JSONUtil jsonUtil) { - this.jsonUtil = jsonUtil; - } - @SuppressWarnings("unchecked") public String intercept(ActionInvocation invocation) throws Exception { HttpServletRequest request = ServletActionContext.getRequest(); @@ -175,6 +168,8 @@ public class JSONInterceptor extends AbstractInterceptor { result = rpcResponse; } + JSONUtil jsonUtil = invocation.getInvocationContext().getContainer().getInstance(JSONUtil.class); + String json = jsonUtil.serialize(result, excludeProperties, getIncludeProperties(), ignoreHierarchy, excludeNullProperties); json = addCallbackIfApplicable(request, json);