Skip to content

RepositoryRestConfiguration with EvoInflectorLinkRelationProvider [DATAREST-1556] #1916

Open
@spring-projects-issues

Description

@spring-projects-issues

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions