2

I've integrated Katharsis with spring-boot (MVC + Security) and I'm realy happy about it.

@SpringBootApplication
@Import(KatharsisConfigV2.class)
@Configuration
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

I began to setup security with an extra spring mvc controller to handle login and logout methods.

But with a RequestBody annotated parameters to convert json to java object, I've got a 400 response telling me required body is missing.

@RequestMapping(value = "/auth/signup", method = RequestMethod.POST)
public @ResponseBody AuthenticationResponse signup(
        @RequestBody AuthenticationRequest authenticationRequest) {
    ...
}

When I remove the import for Katharsis configuration, everything goes fine.

@SpringBootApplication
//@Import(KatharsisConfigV2.class)
@Configuration
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

How could I tweak my project configuration to allow basics spring controllers to accept standard JSON?

Thanks in advance

Fiftoine
  • 271
  • 5
  • 17

1 Answers1

0

What is the exact message in the "detail" field of the response? Katharsis-Spring provides decent error details. That should provide you a better idea of exactly what's wrong.

Remember that POST bodies in JSON API will differ from how they look in regular Spring, e.g. there needs to be a "data" field in your payload.

You may also need to configure Katharsis in your application.properties file. Katharsis can't process requests unless it's configured properly.

Hope this helps.

heez
  • 2,029
  • 3
  • 27
  • 39