Skip to content

Spring Data Rest lists strange "profile" service in 1.2.0.M2 #1718

@mraible

Description

@mraible

I upgraded my Spring Boot 1.1.7 app today to 1.2.0.M2 to use the rest.baseUri property. From my application.yml:

spring:
    data:
        rest.baseUri: /api

When I go to http://localhost:8080/api, I see the following:

{
  "_links" : {
    "patients" : {
      "href" : "http://localhost:8080/api/patients{?page,size,sort}",
      "templated" : true
    },
    "messages" : {
      "href" : "http://localhost:8080/api/messages{?page,size,sort}",
      "templated" : true
    },
    "profile" : {
      "href" : "http://localhost:8080/api/alps"
    }
  }
}

There's a "profile" service listed that I never developed. If I try to hit its "href", it throws a 404. This doesn't happen in 1.1.7. With 1.1.7, I use a @configuration class to specify the prefix.

@Configuration
@Import(RepositoryRestMvcConfiguration.class)
public class RestDataConfig extends RepositoryRestMvcConfiguration {

    @Override
    protected void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
        super.configureRepositoryRestConfiguration(config);
        try {
            config.setBaseUri(new URI("/api"));
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
    }
}

And the result is:

{
  "_links" : {
    "patients" : {
      "href" : "http://localhost:8080/api/patients{?page,size,sort}",
      "templated" : true
    },
    "messages" : {
      "href" : "http://localhost:8080/api/messages{?page,size,sort}",
      "templated" : true
    }
  }
}

On a related note, I noticed that if I have an interface that extends PagingAndSortingRepository, it gets added to the list of APIs, regardless of whether it's annotated with @RepositoryRestResource. Is this as designed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions