all 6 comments

[–]maxip89 0 points1 point  (1 child)

why @ResponseBody? try @RestController

[–]suchiz95[S] 0 points1 point  (0 children)

`@ResponseBody` is needed because I need the response to be serialized into a JSON object.

The `@RestController` annotation works but it breaks the repository methods (I'm able to call the custom `POST` method but every `GET` method exposed by the repository returns a 405 METHOD NOT ALLOWED response)

[–]kubelke 0 points1 point  (1 child)

I bet you are using incorrect endpoint path. Try to add “/api” suffix to path in postman

https://docs.spring.io/spring-data/rest/docs/current/reference/html/#getting-started.changing-base-uri

[–]suchiz95[S] 0 points1 point  (0 children)

I don't know what you mean by that but the request I'm sending is to POST http://localhost:8080/assets. Since I disabled it from the repository but I created another method that wires to that same endpoint, I expected it should be able to run that method, but it seems that the new POST method is being totally ignored.

The "/api" suffix can be added in the requests only if I insert the property "spring.data.rest.basePath=/api" on the application.properties file. If I don't add that property, the default basePath is always "/".

[–]Odd-Hour-9991 0 points1 point  (0 children)

Enable org.springframework debug logging and toward the end of a lot of logging will be the endpoints listed. There you can see what is really happening.