title: GET a sub resource of a Spring Data REST API returns 404 Not Found
body: <p>I'm using Spring Data REST and having problems accessing my resources. I'm able to access a resource at all, e.g. when I'm calling</p>
  
  <p><code>curl -i -X GET http://localhost:18080/myapp/api/picklists/662070</code></p>
  
  <p>I get something like:</p>
  
  <pre><code>{
    "id" : "662070",
  
      ...
  
    "_links" : {
      "self" : {
        "href" : "http://localhost:18080/myapp/api/picklists/662070"
      },
      "picklist" : {
        "href" : "http://localhost:18080/myapp/api/picklists/662070"
      },
      "currentStatus" : {
        "href" : "http://localhost:18080/myapp/api/picklists/662070/currentStatus"
      },
      "picklistPositions" : {
        "href" : "http://localhost:18080/myapp/api/picklists/662070/picklistPositions"
      }
    }
  }
  </code></pre>
  
  <p>If I understand the concept correctly I con now perform GET requests on the items in the links-section to access the related sub-resource. But when I want to follow the link to a related entity like:</p>
  
  <p><code>curl -i -X GET http://localhost:18080/myapp/api/picklists/662070/picklistPositions</code></p>
  
  <p>I always get <code>HTTP/1.1 404 Not Found</code> as response and the following log output:</p>
  
  <p><code>2018-10-19 20:04:44,280 | WARN  [http-nio-18080-exec-13] [org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver.AbstractHandlerExceptionResolver.resolveException(136)]  Resolved [org.springframework.data.rest.webmvc.ResourceNotFoundException: Resource not found!]</code></p>
  
  <p>I don't understand what I'm doing wrong. Every sub-resource has its own public repository and I'm using the default repository detection strategy. </p>
  
  <p>Accessing the sub-resources via
  <code>curl -i -X GET http://localhost:18080/myapp/api/picklistPositions</code>
  however is possible as well.</p>
  
  <p>I'm using Spring Data REST but without Spring Boot. My configuration looks like:</p>
  
  <pre><code>@Configuration
  class CustomRestMvcConfiguration {
  
      private String REST_BASE_PATH = "/api";
  
      @Bean
      public RepositoryRestConfigurer repositoryRestConfigurer() {
          return new RepositoryRestConfigurerAdapter() {
              @Override
              public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
                  config.setBasePath(REST_BASE_PATH);
              }
          };
      }
  
      @Bean
      public BasePathAwareLinkBuilder basePathAwareLinkBuilder(ServletContext servletContext) {
          URI basePath = URI.create(REST_BASE_PATH.startsWith("/") ? REST_BASE_PATH : "/".concat(REST_BASE_PATH));
          return new BasePathAwareLinkBuilder(servletContext, basePath);
      }
  }
  </code></pre>
  
  <p>Any suggestions?</p>