spring-projects / spring-projects/spring-data-rest
RepositoryRestConfiguration with EvoInflectorLinkRelationProvider [DATAREST-1556]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
nilzao opened DATAREST-1556 and commented
class:
org.springframework.data.rest.core.config.RepositoryRestConfiguration
private LinkRelationProvider relProvider = new EvoInflectorLinkRelationProvider();
class:
org.springframework.data.rest.core.mapping.RepositoryCollectionResourceMapping
private static final boolean EVO_INFLECTOR_IS_PRESENT = ClassUtils.isPresent("org.atteo.evo.inflector.English", null);
/*
.....
*/
//constructor
RepositoryCollectionResourceMapping(RepositoryMetadata metadata, RepositoryDetectionStrategy strategy,
LinkRelationProvider relProvider){
//...
CollectionResourceMapping domainTypeMapping = EVO_INFLECTOR_IS_PRESENT
? new EvoInflectorTypeBasedCollectionResourceMapping(domainType, relProvider)
: new TypeBasedCollectionResourceMapping(domainType, relProvider);
//...
}
to disable evo-inflector workaround config (I had to disable evo-inflector, because of another bug that I will report later)
pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
<exclusions>
<exclusion>
<groupId>org.atteo</groupId>
<artifactId>evo-inflector</artifactId>
</exclusion>
</exclusions>
</dependency>
class MyRepositoryRestConfigurerConfig.java
@Configuration
public class MyRepositoryRestConfigurerConfig implements RepositoryRestConfigurer {
@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
config.setRelProvider(new DefaultLinkRelationProvider());
}
}
suggestion:
class org.springframework.data.rest.core.config.RepositoryRestConfiguration
private LinkRelationProvider relProvider = ClassUtils.isPresent("org.atteo.evo.inflector.English", null) ? new EvoInflectorLinkRelationProvider() : new DefaultLinkRelationProvider();
Affects: 3.4 M2 (2020.0.0), 3.3.3 (Neumann SR3)
Reference URL: https://stackoverflow.com/questions/26037045/how-to-globally-customize-the-collection-resource-rel-and-path-for-spring-data-r
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.