Git Product home page Git Product logo

bean-init-modifier-with-hateaoas's Introduction

bean-init-modifier-with-hateaoas

Repository with Spring Boot project to demonstrate that Spring HATEOAS ResourceSupport class breaks the BeanSerializerModifier functionality

I'm using BeanSerializerModifier to be able to implement application-wide functionality to ignore certain JSON rendering of objects that meet a specific condition. Everything works great except for classes that extend the HATEOAS ResourceSupport class. For these classes, the functionality works as expected only if we render Collections of objects of those classes. If we try to render individual objects directly, then the custom serializer is never called.

To demonstrate, run the Spring Boot application using

mvn spring-boot:run

Then run the following commands

curl -X GET http://localhost:8080/list
curl -X GET http://localhost:8080/list-resource

The above two URLs will return the same response. This is expected behavior.

Now run the commands below

curl -X GET http://localhost:8080/person/1
curl -X GET http://localhost:8080/person-resource/1

and

curl -X GET http://localhost:8080/person/2
curl -X GET http://localhost:8080/person-resource/2

Output of these pairs of URLs is different although if everything was working correctly, they would be the same. In the second of these URLs, the custom serializer is not called.

bean-init-modifier-with-hateaoas's People

Watchers

 avatar  avatar

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.