0

So, first of all, apologies if this is a little light on details, but I've been tearing my hair out over this for a whole day, and have not been able to reproduce the issue outside of this project with no luck, and really hope the community can help with at least a pointer to where to start the debugging process.

Basically, I'm updating a project from a very old (1.28) version of Spring boot to the current 2.04, and everything seems to work except for some reason, Spring-hateoas does not seem to render links correctly. Iv'e set up a very simple controller method

@RestController
@RequestMapping("/hello")
public class HateoasTestController {

public static class Greeting extends ResourceSupport{
    private final String name;

    public Greeting(String name) {
        this.name = name;
           add(linkTo(ControllerLinkBuilder.methodOn(HateoasTestController.class).greet(name)).withSelfRel());
    }

    public String getName() {
        return name;
    }

}
@RequestMapping(value="/{name}" ,method=RequestMethod.GET)
public Greeting greet(@PathVariable("name")String name){
    return new Greeting(name);
  }
}

Which gets rendered as

{"name":"peter","link":{"self":[{"href":"http://localhost:6789/hello"}]}}

In the old version of the service it would render as

{"name":"peter","_links":{"self":[{"href":"http://localhost:6789/hello"}]}}

So, it looks like, for some reason, the response does not get serialized as HAL. I've tried to follow the code flow of the Jackson2Hal module, and it does get triggered, but it's kind of difficult to figure out where the magic is supposed to happen. So I guess, my very basic question is, if there's an obvious place to put a breakpoint, to test why the results aren't rendered as expected? and of course, if there is something stupid, I've missed or any more detail I can provide that would be relevant. Basically, any help at this point is welcome

vruum
  • 455
  • 1
  • 5
  • 14

1 Answers1

0

I'm an idiot. Turns out I had enabled findModulesViaServiceLoader(true) in the jacksonobjectmapper builder, which for some reason caused it to fail.

vruum
  • 455
  • 1
  • 5
  • 14