Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Data REST doesn't work as expected after upgrading 1.3.0.M3 from 1.3.0.M2 #3731

Closed
izeye opened this issue Aug 12, 2015 · 5 comments
Closed

Comments

@izeye
Copy link
Contributor

izeye commented Aug 12, 2015

After upgrading 1.3.0.M3 from 1.3.0.M2,

page element doesn't exist and mapped entities' _embedded doesn't exist.

This is a sample reproducing the problem:

https://github.com/izeye/organizer

With 1.3.0.M2, when visiting /links, got the following:

{
  "_links" : {
    "self" : {
      "href" : "http://localhost:18080/links"
    }
  },
  "_embedded" : {
    "links" : [ {
      "createdTime" : "2015-08-12T09:04:15.509+0000",
      "modifiedTime" : null,
      "deletedTime" : null,
      "url" : "https://www.oracle.com/",
      "title" : "Java",
      "_links" : {
        "self" : {
          "href" : "http://localhost:18080/links/1"
        },
        "tags" : {
          "href" : "http://localhost:18080/links/1/tags"
        }
      }
    }, {
      "createdTime" : "2015-08-12T09:04:15.526+0000",
      "modifiedTime" : null,
      "deletedTime" : null,
      "url" : "https://spring.io/",
      "title" : "Spring",
      "_links" : {
        "self" : {
          "href" : "http://localhost:18080/links/2"
        },
        "tags" : {
          "href" : "http://localhost:18080/links/2/tags"
        }
      }
    }, {
      "createdTime" : "2015-08-12T09:04:15.527+0000",
      "modifiedTime" : null,
      "deletedTime" : null,
      "url" : "http://projects.spring.io/spring-boot/",
      "title" : "Spring Boot",
      "_links" : {
        "self" : {
          "href" : "http://localhost:18080/links/3"
        },
        "tags" : {
          "href" : "http://localhost:18080/links/3/tags"
        }
      }
    } ]
  },
  "page" : {
    "size" : 20,
    "totalElements" : 3,
    "totalPages" : 1,
    "number" : 0
  }
}

and when visiting /links/1/tags, got the following:

{
  "_links" : {
    "self" : {
      "href" : "http://localhost:18080/links/1/tags"
    }
  },
  "_embedded" : {
    "tags" : [ {
      "createdTime" : "2015-08-12T09:04:15.346+0000",
      "modifiedTime" : null,
      "deletedTime" : null,
      "name" : "java",
      "_links" : {
        "self" : {
          "href" : "http://localhost:18080/tags/1"
        }
      }
    } ]
  }
}

But with 1.3.0.M3, when visiting /links, got the following:

  "_links" : {
    "self" : {
      "href" : "http://localhost:18080/links",
      "templated" : false
    }
  },
  "_embedded" : {
    "links" : [ {
      "createdTime" : "2015-08-12T08:57:35.174+0000",
      "modifiedTime" : null,
      "deletedTime" : null,
      "url" : "https://www.oracle.com/",
      "title" : "Java",
      "_links" : {
        "self" : {
          "href" : "http://localhost:18080/links/1",
          "templated" : false
        },
        "link" : {
          "href" : "http://localhost:18080/links/1",
          "templated" : false
        },
        "tags" : {
          "href" : "http://localhost:18080/links/1/tags",
          "templated" : false
        }
      }
    }, {
      "createdTime" : "2015-08-12T08:57:35.183+0000",
      "modifiedTime" : null,
      "deletedTime" : null,
      "url" : "https://spring.io/",
      "title" : "Spring",
      "_links" : {
        "self" : {
          "href" : "http://localhost:18080/links/2",
          "templated" : false
        },
        "link" : {
          "href" : "http://localhost:18080/links/2",
          "templated" : false
        },
        "tags" : {
          "href" : "http://localhost:18080/links/2/tags",
          "templated" : false
        }
      }
    }, {
      "createdTime" : "2015-08-12T08:57:35.183+0000",
      "modifiedTime" : null,
      "deletedTime" : null,
      "url" : "http://projects.spring.io/spring-boot/",
      "title" : "Spring Boot",
      "_links" : {
        "self" : {
          "href" : "http://localhost:18080/links/3",
          "templated" : false
        },
        "link" : {
          "href" : "http://localhost:18080/links/3",
          "templated" : false
        },
        "tags" : {
          "href" : "http://localhost:18080/links/3/tags",
          "templated" : false
        }
      }
    } ]
  }
}

and when visiting /links/1/tags, got the following:

{
  "_links" : {
    "self" : {
      "href" : "http://localhost:18080/links/1/tags",
      "templated" : false
    }
  }
}
@wilkinsona
Copy link
Member

I'd be surprised if this had anything to do with Boot itself. It's more likely a side-effect of the move from Spring Data REST 2.4.0.M1 (Gosling M1) to Spring Data REST 2.4.0.RC1 (Gosling RC1). Hopefully, @olivergierke can provide some insight.

odrotbohm added a commit to spring-projects/spring-hateoas that referenced this issue Aug 12, 2015
…verter drop information on rendering on Spring 4.2 and Jackson 2.6.

Related tickets: spring-projects/spring-boot#3731
@cedricziel
Copy link

(Subscribing. Same here)

@odrotbohm
Copy link
Member

This seems to be caused by a tweak to improve the integration with Jackson 2.6 for collections but unfortunately has the side effect of the controller method's declared return type to be used to look up the serializer instead of the value actually returned. There's a ticket in Spring Framework's JIRA.

I've created a test case in Spring HATEOAS to reproduce the error. It's a bit of a pity as we of course have test cases for the rendering, but all of them using an ObjectMapper directly and thus not checking the special set up with AbstractJackson2HttpMessageConverter.

@wilkinsona
Copy link
Member

@cedricziel FYI, you don't need to comment to subscribe – there's a button in the Notifications section of the right-hand column (on the desktop layout).

odrotbohm added a commit to spring-projects/spring-hateoas that referenced this issue Aug 31, 2015
…verter drop information on rendering on Spring 4.2 and Jackson 2.6.

Related tickets: spring-projects/spring-boot#3731
odrotbohm added a commit to spring-projects/spring-hateoas that referenced this issue Aug 31, 2015
…verter drop information on rendering on Spring 4.2 and Jackson 2.6.

Related tickets: spring-projects/spring-boot#3731
odrotbohm added a commit to spring-projects/spring-hateoas that referenced this issue Sep 1, 2015
…r drop information on rendering on Spring 4.2 and Jackson 2.6.

Related tickets: spring-projects/spring-boot#3731, SPR-13318.
@izeye
Copy link
Contributor Author

izeye commented Sep 7, 2015

I confirmed it works again with Spring Boot 1.3.0.M5 (thanks to #3758, SPR-13318). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants