title: Naming Spring page keys in HATEOAS _embedded PagedResource
body: <p>We are currently implementing an API library in our newest project.
  We are trying to use Spring HATEOAS with HAL as the apropriate library to generate json hal responsed.</p>
  
  <p>Using Spring boot 1.2.5.RELEASE + the provided Spring HATEOAS version.
  Currently we are mapping the actual JPA entities to be returned as Resources.</p>
  
  <p>I.e. our entity looks like this:</p>
  
  <pre><code>import lombok.Getter;
  import lombok.Setter;
  
  @Getter
  @Setter
  @Entity
  @Table(name = "users")
  public class User {
  
      @Id
      private UUID id;
  
      @Column(nullable = false, length = 70)
      private String firstName;
  
      @Column(nullable = false, length = 70)
      private String lastName;
  }
  </code></pre>
  
  <p>Our repository:</p>
  
  <pre><code>public interface UserRepository extends PagingAndSortingRepository&lt;User, UUID&gt;, JpaSpecificationExecutor&lt;User&gt; {
      User findByUsername(String username);
  }
  </code></pre>
  
  <p>Our service:</p>
  
  <pre><code>@Service
  @Transactional
  public class UserService implements UserDetailsService {
  
      private UserRepository userRepository;
  
      @Autowired
      public UserService(UserRepository userRepository) {
          this.userRepository = userRepository;
      }
  
      @Transactional
      public Page&lt;User&gt; findAll(Pageable pageable) {
          return this.userRepository.findAll(pageable);
      }
  }
  </code></pre>
  
  <p>The RestController:</p>
  
  <pre><code>@RestController
  @RequestMapping(value = "/users", produces =MediaType.APPLICATION_JSON_VALUE) // this is done otherwise objectmapper returns xml for some reason
  public UserRestController {
  
      public UserService userService;
      public EntityLinks entityLinks;
  
      @Autowired
      public UserRestController(UserService userService, EntityLinks entityLinks) {
          this.userService = userService;
          this.entityLinks = entityLinks;
      }
  
      @RequestMapping(method = RequestMethod.GET)
      public PagedResource&lt;Resource&lt;User&gt;&gt; getUsers(Pageable pageable, PagedResourcesAssembler&lt;User&gt; pagedResourcesAssembler) {
          Page&lt;User&gt; userPage = this.userService.findAll(pageable);
  
          PagedResources&lt;Resource&lt;User&gt;&gt; userPagedResources =
              pagedResourcesAssembler.toResource(
                      usersPage,
                      linkTo(methodOn(UserRestController.class).showUsers(pageable, pagedResourcesAssembler)).withSelfRel());
  
          return userPagedResources;
  
      }
  }
  </code></pre>
  
  <p>Lets say i set the default page size to 1 the pages are getting generated apropriately. Setting the links to prev/next page. The '<em>embeddable' attribute is being generated but then we get "userList": [{user}] on page one and page two gets us "user</em>$$_jvst163_9List": [{user}].</p>
  
  <p>Is there a way to actually name the page list property (i've been trying to find something on the net but no avail).</p>
  
  <p>For example:</p>
  
  <pre><code>{
    "_links": {
      "self": {
        "href": "http://localhost:8080/users{?page,size,sort}",
        "templated": true
      },
      "next": {
        "href": "http://localhost:8080/users?page=1&amp;size=1&amp;sort=firstname,lastname,asc"
      }
    },
    "_embedded": {
      "userList": [{
        "id": "2027bea9-cfdc-4724-b29c-39b3f64cbfd5",
        "firstname": "admin",
        "lastname": "asdf",
      }]
    },
    "page": {
      "size": 1,
      "totalElements": 2,
      "totalPages": 2,
      "number": 0
    }
  }
  {
    "_links": {
      "self": {
        "href": "http://localhost:8080/users{?page,size,sort}",
        "templated": true
      },
      "prev": {
        "href": "http://localhost:8080/users?page=0&amp;size=1&amp;sort=firstname,lastname,asc"
      }
    },
    "_embedded": {
      "user_$$_jvst163_9List": [{
        "id": "52c0c09e-c386-4aec-9723-f8beaf99adc5",
        "username": "admin",,
        "firstname": "firstname",
        "lastname": "lastname"
      }]
    },
    "page": {
      "size": 1,
      "totalElements": 2,
      "totalPages": 2,
      "number": 1
    }
  }
  </code></pre>