Coder Social home page Coder Social logo

Comments (7)

Lance-Drane avatar Lance-Drane commented on August 14, 2024 28

You can access the data through a browser as well as CURL if you change all GetMapping annotations to something like this:

@GetMapping(value = "/employees", produces = "application/json; charset=UTF-8")

from tut-rest.

nvwieren avatar nvwieren commented on August 14, 2024 9

Calling the url using a browser (ie Google Chrome) causes this issue - it seems the browser prefers an XML response and Spring adheres to that.. Using something like Postman avoids the issue and returns the expected result.

from tut-rest.

nvwieren avatar nvwieren commented on August 14, 2024 2

As for the imports -

import static org.springframework.hateoas.mvc.ControllerLinkBuilder.*;

from tut-rest.

gregturn avatar gregturn commented on August 14, 2024 2

As of spring-projects/spring-hateoas@dca65e1, the JAXB annotations have been removed and should no longer cause this issue

However you may have to wait for Spring Data REST to catch up to Spring HATEOAS 1.0.0.BUILD-SNAPSHOT.

from tut-rest.

mlvandijk avatar mlvandijk commented on August 14, 2024

Good to know I had the right imports. I'd like to find a way to do the tutorial without having to use additional tools like Postman, but good to know where the error comes from. Thank you!

from tut-rest.

gregturn avatar gregturn commented on August 14, 2024

Indeed. Spring HATEOAS had XML support before we added HAL support. Long story short, the JAXB annotations are still there, but not very usable.

See spring-projects/spring-hateoas#695.

from tut-rest.

jason279 avatar jason279 commented on August 14, 2024

I have the same "jaxbexception", and thank @Lance-Drane ,who solves it.

from tut-rest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.