spring-projects / spring-data-commons

Spring Data Commons. Interfaces and code shared between the various datastore specific implementations.
https://spring.io/projects/spring-data
Apache License 2.0
770 stars 670 forks source link

Add flags to register pageable/sort resolvers on @EnableSpringDataWebSupport [DATACMNS-1494] #1929

Open spring-projects-issues opened 5 years ago

spring-projects-issues commented 5 years ago

Tadaya Tsuyukubo opened DATACMNS-1494 and commented

I would like to have flags to control registering default pageable and sort resolvers on @EnableSpringDataWebSupport.

In my use case, I register a resolver for Pageable which collide with the default resolver registered by SpringDataWebConfiguration.

DATACMNS-822 introduced customizers but that still registers default resolvers.

In DATACMNS-1016, there is a comment saying extend the configuration class and "@Import" it instead of using _@EnableSpringDataWebSupport_. That for sure works, but requires an extended class and use "@Import" instead of "@Enabled..."

Since adding that control in @EnableSpringDataWebSupport is more intuitive from user perspective, I want "registerPageableResolver" and "registerSortResolver" flags to be added on @EnableSpringDataWebSupport.

PR will follow


No further details from DATACMNS-1494

spring-projects-issues commented 5 years ago

Tadaya Tsuyukubo commented

PR: https://github.com/spring-projects/spring-data-commons/pull/345

spring-projects-issues commented 5 years ago

Oliver Drotbohm commented

Rather than introducing a completely different mechanism to control a related aspect of the configuration, do you think we could refactor the customizers to allow controlling the creation of the resolvers as well?

spring-projects-issues commented 5 years ago

Tadaya Tsuyukubo commented

I think with customizer approach, there will be ordering issue.

For example, let's say customizer-A that creates Foo, and customizer-B that updates some property on Foo. If customizer-B applied first, then it will just skip since there is no Foo. Then, customizer-A will create a Foo. In this case, customizer-B gets ignored