I am using Spring Boot (2.1.1) to automatically create an HAL REST API of my JpaRepository
interfaces.
For most cases these interfaces are empty, for example:
public interface ProjectRepository extends JpaRepository<Project, Long> {}
public interface ProtocolRepository extends JpaRepository<Protocol, Long> {}
A Project
-entity contains many Protocol
-entities.
And a Protocol
-entity has a back-link to its Project
-entity.
When I visit http://localhost:8080/admin/protocols/4711
I get the link to its project:
...
"project": {
"href": "http://localhost:8080/admin/protocols/4711/project"
}
...
But when I follow that link all further links are generated faulty:
...
"_links": {
"self": {
"href": "http://localhost:8080/admin/project/1"
},
"project": {
"href": "http://localhost:8080/admin/project/1"
}
...
}
...
The error in the link is that the singular noun project
is used, instead of the plural form projects
.
As these links are automatically generated, it is not obvious how this behavior can be changed.