Search code examples
jsonspringspring-bootjacksonresponse

Spring ScopedProxy session Bean JSON exports targetClass details in JSON response


When I send a session scoped bean in response it generates the following as details as well:

    "accountNonExpired": true,
  "accountNonLocked": true,
  "credentialsNonExpired": true,
  "enabled": true,
  "chfDbqUserLevel": 1,
  "eurDbqUserLevel": 1,
  "frozen": false,
  "targetClass": "com.......models.PxUser",
  "targetSource": {
    "targetBeanName": "scopedTarget.pxUser",
    "targetClass": "com......models.PxUser",
    "beanFactory": {
      "parentBeanFactory": null,
      "beanClassLoader": {
        "parent": {
          "parent": {
            "parent": {
              "parent": null,
              "urls": [
                "file:/C:/Program%20Files/Java/jdk1.8.0_92/jre/lib/ext/access-bridge-64.jar",
                "file:/C:/Program%20Files/Java/jdk1.8.0_92/jre/lib/ext/cldrdata.jar",
                "file:/C:/Program%20Files/Java/jdk1.8.0_92/jre/lib/ext/dnsns.jar",

How can exclude targetClass details from response?

Thanks


Solution

  • Try adding @JsonIgnoreProperties("targetClass") for you session managed bean.