Skip to content

Conversation

marceloverdijk
Copy link

@marceloverdijk marceloverdijk commented Mar 28, 2017

I would like to be able to provide default querydsl bindings for all @QuerydslPredicate being used.

You could think about excluding unlisted properties by default or add default behaviour for certain types.

Of course it should still be possible to provide a custom QuerydslBinderCustomizer via the @QuerydslPredicate but it should also apply the default bindings.

Something like this:

public class QuerydslWebConfig extends QuerydslWebConfiguration {

    @Bean
    public QuerydslBindingsFactory querydslBindingsFactory() {
        return new QuerydslBindingsFactory(SimpleEntityPathResolver.INSTANCE, defaultBindings());
    }

    public QuerydslBinderCustomizer<?> defaultBindings() {
        return new QuerydslBinderCustomizer<?>() {
            
            @Override
            public void customize(final QuerydslBindings bindings, final EntityPath root) {
                bindings.excludeUnlistedProperties(true);
                bindings.bind(String.class).first((StringPath path, String value) -> {
                    // default logic for String type.
                });
            }
        };
    }
}

https://jira.spring.io/browse/DATACMNS-1022

Aloren pushed a commit to Aloren/spring-data-commons that referenced this pull request Jun 20, 2019
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 4, 2021
@schauder schauder added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 18, 2021
mp911de added a commit that referenced this pull request Feb 4, 2021
We now consider default Querydsl bindings when registering a DefaultQuerydslBinderCustomizer bean. The default bindings are applied before applying type-specific bindings.

Closes #206.
@mp911de
Copy link
Member

mp911de commented Feb 4, 2021

Sorry for the long radio silence. We decided to follow a slightly different approach, see #2292.

christophstrobl added a commit that referenced this pull request Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants