Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RepositoryRestConfiguration with EvoInflectorLinkRelationProvider [DATAREST-1556] #1916

Open
spring-projects-issues opened this issue Aug 13, 2020 · 0 comments
Assignees
Labels

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Aug 13, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants