Commit Graph

115 Commits

Author SHA1 Message Date
Oliver Drotbohm
092e23b08c DATACMNS-1470 - Further adaption of Spring HATEOAS 1.0 API changes. 2019-02-15 11:07:10 +01:00
Greg Turnquist
8c076f921d DATACMNS-1470 - Upgrade to Spring HATEOAS 1.0 API 2019-02-02 00:09:48 +01:00
Mark Paluch
1969f4bcdc DATACMNS-1459 - Update copyright years to 2019. 2019-01-02 12:12:19 +01:00
Oliver Drotbohm
566e6a3258 DATACMNS-1455 - HateoasPageableHandlerMethodArgumentResolver handles Pageable.unpaged() coprrectly.
Pageable.unpaged() is now effectively handled like a null value given in the 1.x branch.
2018-12-21 09:55:11 +01:00
Oliver Gierke
8b6cc3af11 DATACMNS-1386 - Avoid strong type dependency to Jackson in SpringDataWebConfiguration.
We now avoid using a Lambda to provide a default ObjectMapper instance in the code that's reflectively guarded against Jackson not being present. The lambda causes a method to be generated for the class that will require ObjectMapper to be present on reflection inspection of that method. Switching to a method reference to ObjectMapper's constructor resolves that problem as the indirection via the additional, offending method is not needed.

Further reading: https://www.javabullets.com/how-lambdas-and-anonymous-inner-classesaic-work/
2018-09-07 12:09:29 +02:00
Oliver Gierke
b8974a292a DATACMNS-1292 - Improved default setup of XMLBeam.
We now explicitly disable entity expansion in the DocumentBuilderFactory used by XMLBeam.

Introduced constructor in XmlBeamHttpMessageConverter to allow dedicated configuration of an XBProjector instance in case the defaults need tweaking and augmented the web configuration setup to automatically pick up a custom XmlBeamHttpMessageConverter bean instead of our own default if present.
2018-05-08 09:52:35 +02:00
Robert Winkler
6275ded50f DATACMNS-1293 - Fixed Querydsl package reference in QuerydslPredicateArgumentResolver Javadoc.
Original pull request: #284.
2018-04-12 14:33:15 +02:00
Oliver Gierke
08d748a6fd DATACMNS-1282 - Switched to SimpleEvaluationContext in MapDataBinder. 2018-03-27 16:21:58 +02:00
Oliver Gierke
613cf08f72 DATACMNS-1264 - MapDataBinder now rejects improper property expressions.
We now make sure that type expressions cannot be used in SpEL expressions handled by MapDataBinder. They're gonna be rejected by considering the property not writable. SpEL expression evaluation errors are now forwarded as NotWritablePropertyException to make sure the failure gets handled as if the property referred to doesn't exist.
2018-02-26 21:30:54 +01:00
Oliver Gierke
dcb8166bbc DATACMNS-1235 - Polishing.
Introduced BeanLookup to easily create a Lazy<T>-based lookup of a unique bean by type on a ListableBeanFactory. This is in support of making it easy for downstream Spring Data modules to consume the EntityPathResolver declared in an ApplicationContext using XML configuration.

QuerydslWebConfiguration now uses a plain ObjectProvider to access the bean defined falling back to our default.

Original pull request: #265.
2018-01-10 12:07:31 +01:00
Mark Paluch
51e7e1b7f5 DATACMNS-1240 - Update copyright years to 2018.
Also, remove some trailing whitespaces and align outdated license header format.
2018-01-08 16:04:34 +01:00
Oliver Gierke
eb2163a29e DATACMNS-563 - Polishing.
Removed obsolete generics. Rearranged some code for better readability.

Original pull request: #267.
2017-12-30 12:14:27 +01:00
Marcel Overdijk
da163fc9e4 DATACMNS-563 - PagedResourcesAssembler now correctly forwards one-index settings to PageMetadata.
Original pull request: #267.
2017-12-30 12:03:23 +01:00
Oliver Gierke
d978c9e7b5 DATACMNS-1237 - Register additional ProxyingHandlerMethodArgumentResolver as first resolver.
We now deploy a custom BeanPostProcessor to customize RequestMappingHandlerAdapter instances by prepending a ProxyingHandlerMethodArgumentResolver (requiring a @ModelAttribute) to the list of resolved HandlerMethodArgumentResolvers to make sure the settings defined in the annotation are applied but the projecting way of data binding is still used.
2017-12-20 22:24:12 +01:00
Oliver Gierke
34cadd0b9b DATACMNS-1224 - Polishing of nullability annotations.
Refactored code to properly check for null fields in Eclipse. Added warning suppressions where suitable.
2017-11-30 00:29:32 +01:00
stonio
aabd9d9860 DATACMNS-1193 - Fixed typo in JavaDoc and reference documentation of PageableDefaults.
Original pull request: #218.
2017-10-10 11:50:55 +02:00
Oliver Gierke
2cfd6b8966 DATACMNS-1152 - Setup of ProjectingJackson2HttpMessageConverter now tries to use unique ObjectMapper from ApplicationContext.
We're now trying to look up a uniquely available ObjectMapper instance from the application context falling back to a simple new instance in case none can be found.
2017-09-06 17:11:51 +02:00
Christoph Strobl
0669632a61 DATACMNS-1141 - Add missing NonNullApi and Nullable annotations. 2017-08-28 13:32:47 +02:00
Oliver Gierke
d018757995 DATACMNS-1144 - @JsonPath now supports multiple path expressions.
Path expressions are now evaluated one by one with the first one actually available in the payload being used for value lookup. Also tweaked the default behavior to return null in case of an single, invalid path.
2017-08-24 12:56:19 +02:00
Oliver Gierke
af56889e72 DATACMNS-1123 - Upgraded to XmlBeam 1.4.12 and tweaked HttpMessageConverter implementation.
XmlBeam 1.4.11 accidentally removed ProjectionFactory as public interface. Adapted our HttpMessageConverter implementation to make sure we still work on those versions.

Related ticket: https://github.com/SvenEwald/xmlbeam/issues/45
2017-07-24 14:17:36 +02:00
Oliver Gierke
049970874d DATACMNS-1114 - Introduced usage of nullable annotations for API validation.
Marked all packages with Spring Frameworks @NonNullApi. Added Spring's @Nullable to methods, parameters and fields that take or produce null values. Adapted using code to make sure the IDE can evaluate the null flow properly. Fixed Javadoc in places where an invalid null handling policy was advertised. Strengthened null requirements for types that expose null-instances.

Removed null handling from converters for JodaTime and ThreeTenBP. Introduced factory methods Page.empty() and Page.empty(Pageable). Introduced default methods getRequiredGetter(), …Setter() and …Field() on PersistentProperty to allow non-nullable lookups of members. The same for TypeInformation.getrequiredActualType(), …SuperTypeInformation().

Tweaked PersistentPropertyCreator.addPropertiesForRemainingDescriptors() to filter unsuitable PropertyDescriptors before actually trying to create a Property instance from them as the new stronger nullability requirements would cause exceptions downstream.

Lazy.get() now expects a non-null return value. Clients being able to cope with null need to call ….orElse(…).

Original pull request: #232.
2017-07-24 10:47:28 +02:00
Oliver Gierke
d9b16d8a27 DATACMNS-1085 - Fixed typos in Javadoc.
Original pull request: #229.
2017-07-24 10:32:19 +02:00
Oliver Gierke
8026e9ff72 DATACMNS-1106 - Removed deprecations in ProjectionFactory.
Removed the deprecated implementation of ResourceLoaderAware in favor of BeanClassLoaderAware. Removed deprecated ProjectionFactory.getInputProperties() in favor of ….getProjectionInformation(). Removed the Java conditional to add a MethodInterceptor for default methods. Adapted test cases.
2017-07-11 11:18:18 +02:00
Oliver Gierke
f44255b9a8 DATACMNS-1102 - Reuse ConversionService in ProjectingMethodInterceptors created by ProxyProjectionFactory.
Applied the same to internals of MapDataBinder.
2017-07-05 09:41:21 +02:00
Oliver Gierke
2eb830d68f DATACMNS-822 - Polishing.
Switched to implement WebMvcConfigurer over extending WebMvcConfigurerAdapter. Formatting, assertions, Javadoc.

Original pull request: #208.
2017-05-12 16:57:02 +02:00
Jens Schauder
364ed9ab2e DATACMNS-822 - Polishing.
Replaced optional dependencies with Optional and explicit null checks with calls to ifPresent. Used Lambda style instead of anonymous classes where applicable. Converted Hamcrest matchers to AssertJ. 
Minor improvements to formatting.

Original pull request: #208.
2017-05-12 16:57:02 +02:00
Vedran Pavic
c1036b2204 DATACMNS-822 - Provide customizers for default pageable and sort resolvers.
Introduced dedicated callback interfaces to customize the HandlerMethodArgumentResolver instances registered by SpringDataWebConfiguration. This allows bean definition registration of those customizer interfaces instead of having to extend a configuration class.

Original pull request: #208.
2017-05-12 16:57:02 +02:00
Mark Paluch
14647f9192 DATACMNS-1021 - Add Order.asc(…) and Order.desc(…) factory methods.
We now support Order creation with Order.asc(String) and Order.desc(String) factory methods as shortcut to constructor creation via new Order(Direction, String).

Sort.by(Order.asc("age"), Order.desc("name"));

Deprecated Order(String) constructor in favor of the Order.by(String) factory method. Replace references to new Order(String) with Order.by(String).

Original pull request: #211.
2017-04-26 16:48:40 +02:00
Oliver Gierke
46d7e47239 DATACMNS-1042 - PagedResourceAssembler now keeps pagination information for self link.
We now hand the Pageable contained in the Page to the code that constructs the self link.

Added toEmptyResource(Page, Class) to force clients to resolve an optional base link before calling the method. Removed deprecated method to append pagination template parameters.
2017-04-21 16:48:59 +02:00
Oliver Gierke
9d315af70a DATACMNS-993 - Polishing.
Removed custom JUnit integration as we can just create HidingClassLoader instances in the test and the integration actually causes more code being needed (additional JUnit rule, method level annotations etc.).

Tweaked ShadowingClassLoader to make obvious what has been changed over the Spring Framework variant. Created upstream ticket [0] to ask for the tweaks that would allow us to remove the class again.

Changed SpringDataWebConfigurationImportSelector to be lenient against the ResourceLoader not being available.

Original pull request: #202.
Related ticket: SPR-15439
[0] https://jira.spring.io/browse/SPR-15439
2017-04-12 08:03:38 +02:00
Jens Schauder
65734739bd DATACMNS-993 - Clean up class loader hacking in tests.
ClassLoaderRule with @ClassLoaderConfiguration allows easy creation FilteringClassLoader. Changed usage pattern of ClassUtils.isPresent(…) in order to ease testing. Copied the ShadowingClassloader from SpringFramework to get a constructor that doesn't shadow anything by default.

Original pull request: #202.
2017-04-12 08:03:32 +02:00
Oliver Gierke
417e728e77 DATACMNS-867 - Moved to new factory methods for Sort.
Codebase now uses Sort.by(…) where possible instead of the deprecated new Sort(…).
2017-03-24 08:00:46 +01:00
Oliver Gierke
dec820d6c2 DATACMNS-867 - Removed handling of null Pageables.
Pageable now exposes a dedicated null-object representing the absence of pagination so that all places that previously handled null values can now rather be more relaxed and assume that a non-null value is given.
2017-03-24 08:00:46 +01:00
Oliver Gierke
917c3e2889 DATACMNS-867 - Removed Optional from QuerydslBindingsFactory API. 2017-03-24 08:00:45 +01:00
Christoph Strobl
be347eaaab DATACMNS-867 - Additional Java 8 language feature cleanup.
Make use of lambdas and method references though out the codebase. Remove no longer required generic type parameters.
Additionally remove unused imports and replace single element list initialization with dedicated singletonList.
Use Assertion overloads taking Supplier for dynamic assertion error messages.
2017-03-24 08:00:43 +01:00
Oliver Gierke
282881a64c DATACMNS-867 - Removed obsolete reference to Environment from @EnableSpringDataWebSupport. 2017-03-24 08:00:42 +01:00
Oliver Gierke
9c6f764131 DATACMNS-867 - Consistent non-capitalization of Querydsl. 2017-03-24 08:00:42 +01:00
Oliver Gierke
d4811e29d9 DATACMNS-867 - Second draft. 2017-03-24 08:00:23 +01:00
Oliver Gierke
cc63e5b7a4 DATACMNS-867 - First draft. 2017-03-24 08:00:23 +01:00
Oliver Gierke
27ce92cd16 DATACMNS-987 - Polishing.
Removed a bit of reflection from ApplicationContext interaction. Some generics tweaks to avoid unnecessary casts and compiler warnings. Static methods where possible. JavaDoc polish in ProjectingJackson2HttpMessageConverter.
2017-02-13 13:36:00 +01:00
Mark Paluch
f453130569 DATACMNS-987 - Polishing.
Remove unused Querydsl tests. Add author. Reformat code. Extend Javadoc.
2017-02-13 13:32:42 +01:00
Jens Schauder
0ad1a8dad3 DATACMNS-987 - Jackson converter gets only loaded if Jackson and Jayway dependencies are present.
Added a test for loading of QuerydslPredicateArgumentResolver, but it fails presumably because EnableSpringDataWebSupport is not in effect.

Renamed SpringDataWebConfigurationUnitTests to SpringDataWebConfigurationIntegrationTests since it is actually an integration test.

Related ticket: DATACMNS-993.
2017-02-13 13:32:39 +01:00
Christoph Strobl
3e048a6dca DATACMNS-985 - Remove references to single-argument assertion methods. 2017-01-31 18:10:40 +01:00
Oliver Gierke
88e70a2730 DATACMNS-776 - Made ProxyingHandlerMethodArgumentResolver to only support user types or annotated ones.
ProxyingHandlerMethodArgumentResolver is now more lenient when it comes to which types to support for proxying. As indicated in the ticket, we've been to aggressive opting in for all interfaces which - depending on the order of converter registrations - caused us interfering with other interface based resolutions (e.g. in Spring Mobile, Security etc.).

We now only aggressively kick in if either the type or parameter is annotated with @ProjectedPayload or the type itself is not a Spring Framework or native Java one. This should leave user defined types still be accepted whereas the types we previously erroneously interfered with should now be ignored.
2017-01-23 11:42:25 +01:00
Oliver Gierke
50b84e701f DATACMNS-972 - Fixed ProjectingJackson2HttpMessageConverter.canRead(…) for generic type variables.
ProjectingJackson2HttpMessageConverter.canRead(…) now resolves the given type correctly, even in context of their owning class.
2017-01-19 12:30:08 +01:00
Mark Paluch
8bafe7964b DATACMNS-973 - Polishing.
Convert @see http://… links to valid format using @see <a href=…>…</a>.
2017-01-13 08:50:54 +01:00
Oliver Gierke
9354800225 DATACMNS-952 - Switched from component scanning to SpringFactoriesLoader for internal extension points.
Both the configuration code looking up Spring Data specific Jackson modules as well as the code detecting whether we have multiple Spring Data modules on the classpath used component scanning. That can have quite significant impact on startup times.

This commit replaces the classpath scanning with the use of SpringFactoriesLoader that now requires modules that want to extend the behavior of Spring Data's web configuration or indicate a repository implementation being present by shipping a file called META-INF/spring.factories. Spring Data relies on the following keys:

- org.springframework.data.web.config.SpringDataJacksonModules - list the Spring configuration classes that will expose additional Jackson modules that are supposed to be registered for Spring Data's Jackson web support
- org.springframework.data.repository.core.support.RepositoryFactorySupport - list the Spring Data repository factory implementation class that implements repository support for your module. The general detection and configuration mechanism for user repositories is not affected by this. Currently Spring Data only uses the pure number of different entries for that key to switch into strict configuration mode in case we find more than one entry.
2016-12-05 13:55:05 +01:00
Oliver Gierke
a8b2eb1589 DATACMNS-918 - Polishing.
Minor JavaDoc stuff.
2016-11-29 14:15:19 +01:00
Mark Paluch
08d9a61ea3 DATACMNS-918 - Provide interfaces for Pageable and Sort method argument resolvers.
We now provide HandlerMethodArgumentResolver interfaces to resolve Sort and Pageable method arguments with typed return values.
2016-11-29 14:15:19 +01:00
Oliver Gierke
2e4e6ee61f DATACMNS-929 - Fixed NullPointerException in PageableHandlerMethodArgumentResolver.
PageableHandlerMethodArgumentResolver.isFallbackPageable() now correctly guards against the fallback Pageable being null, a situation that's explicitly deemed valid in setFallbackPageable(…).
2016-11-01 18:04:54 +01:00