By default, Spring data REST use camelCase for endpoint names.
For example, if the repository is
@RepositoryRestResource(collectionResourceRel = "users", path = "users")
public interface UserRepository extends PagingAndSortingRepository<User, Integer> {
List<User> findByUsername(@Param("username") String username);
}
Then the endpoint is http://localhost:8080/users/search/findByUsername?username=test
How can I customize the endpoint so it use snake_case, became like this: http://localhost:8080/users/search/find_by_username?username=test
Or even different method name
- change
find_by_username:http://localhost:8080/users/search/by_username?username=test - (stripping the
find_by_username):http://localhost:8080/users/search?username=test
Thanks