713 Commits

Author SHA1 Message Date
Thomas Darimont
6cf8269f8f DATACMNS-518 - Avoid potential infinite loops in PreferredConstructor.
We now synchronize the (seldom) writes to the isPropertyParameterCache HashMap in PreferredConstructor via a ReadWriteLock. We could as well have used a ConcurrentHashMap here without the need for manual locking but this would potentially waste memory for a mostly read-only data structure. We also anticipate potential multiple writes for the same property.

Original pull request: #86.
2014-06-26 14:09:41 +02:00
Oliver Gierke
2f233effae DATACMNS-522 - After release cleanups. 2014-06-18 14:36:37 +02:00
Spring Buildmaster
6186e36b74 DATACMNS-522 - Prepare next development iteration. 2014-06-18 02:43:36 -07:00
Spring Buildmaster
f9166f7cf9 DATACMNS-522 - Release version 1.7.3.RELEASE (Codd SR3). 2014-06-18 02:43:30 -07:00
Oliver Gierke
a483bd02cf DATACMNS-522 - Prepare 1.7.3.RELEASE (Codd SR3). 2014-06-18 11:37:58 +02:00
Oliver Gierke
4a642b48f6 DATACMNS-522 - Updated changelog. 2014-06-18 11:37:37 +02:00
Oliver Gierke
ab8ef8d8e5 DATACMNS-507 - Updated changelog. 2014-06-18 11:36:08 +02:00
Oliver Gierke
a9b8f9b19b DATACMNS-495 - Updated changelog. 2014-06-18 11:35:37 +02:00
Oliver Gierke
2a1e71204d DATACMNS-522 - Upgraded to Spring HATEAOAS 0.13.0.RELEASE. 2014-06-18 10:46:09 +02:00
Oliver Gierke
234d02991e DATACMNS-520 - Fixed @Param validation in Parameters.
Parameters erroneously rejected @Param annotated query method parameters that were preceded by a non-bindable type (like Pageable or Sort) as it checked for a 0 index of the parameter. We now manually keep an index in the check itself and have removed the Parameter.isFirst() method as it's not used anywhere else.
2014-06-12 16:00:10 +02:00
Oliver Gierke
c9c7a5309c DATACMNS-513 - PagedResourcesAssemblerArgumentResolver now correctly resolves mappings for sub-class invocations.
We're now using the newly introduced method on ControllerLinkBuilderFactory that takes both a type and a method to forward the method the invocation is happening on independently from the method being invoked.
2014-06-05 17:15:55 +02:00
Thomas Darimont
3baf79a7e1 DATACMNS-514 - Fixed typo in RepositoryPopulator examples.
The property "location" should actually be "locations" since this attribute is read by org.springframework.data.repository.config.ResourceReaderRepositoryPopulatorBeanDefinitionParser.doParse(Element, BeanDefinitionBuilder).
2014-06-04 11:29:19 +02:00
Oliver Gierke
9a209576a4 DATACMNS-511 - Improve equals(…) and hashCode() in TypeVariableTypeInformation.
The equals(…) and hashCode() methods of TypeVariableTypeInformation previously tried to evaluate the unresolved context of the type variable. This can cause issues in recursive type definitions as set up in the according test case. We now implement the methods based on the resolved type to makes sure we break the recursive lookup of PersistentEntity instances in AbstractMappingContext.

The erroneous lookup was actually caused by unresolved base types being added to the mapping context within the JPA project as the JPA meta-model also returns those types as managed types.

Related pull request: #84.
2014-05-28 15:40:51 +02:00
Oliver Gierke
db30597033 DATACMNS-506 - Added section on escaping underscores in query method names.
We now explicitly discuss the case of referring to properties with underscores (e.g. first_name) in repository query methods.

Added missing language declaration for a code block.
2014-05-19 08:59:09 +02:00
Oliver Gierke
6df464b31c DATACMNS-506 - PreferredConstructorDiscoverer now uses Spring 4's ParameterNameDiscoverer if present.
We now also reflectively check for the presence of DefaultParameterNameDiscoverer. This allows the usage of the new reflection methods introduced in Java 8 if the user code is running on Spring 4.

Changed the name of the constant for the ParameterNameDiscoverer in Parameters to meet conventions for constants.
2014-05-19 08:59:05 +02:00
Oliver Gierke
e3137a1507 DATACMNS-502 - Prevent IndexOutOfBoundException in AnnotationRepositoryConfigurationSource.
If a configuration class resides in the default package and no base package is defined in the @Enable…Repositories annotation we previously failed in extracting the package from the class name (as there is none).

We now use Spring's ClassUtils that correctly handles this case and returns an empty String for the default package.
2014-05-08 12:41:25 +02:00
Oliver Gierke
443da10779 DATACMNS-501 - Work around potential null returned from GenericTypeResolver in Spring 4.
Spring 4's GenericTypeResolver returns null when trying to resolve type arguments for types that do not fully resolve the generic types.

Related issues: SPR-11763.
2014-05-06 09:49:13 +02:00
Christoph Strobl
38ba51c61b DATACMNS-496 - Version.parse(…) now drops non-numeric artifacts.
Version parsing failed when given version contained non-numeric parts (like 2.0.0-rc1). We now strip everything after the first non numeric part to create a logical version equivalent of the source String.

Original pull request: #81.
2014-04-29 16:02:23 +02:00
Oliver Gierke
3e4e9c2b2c DATACMNS-492 - RepositoryConfigurationDelegate now expects an Environment.
Added a constructor to RepositoryConfigurationDelegate that takes an additional Environment instance to make sure we can equip ClasspathScanningCandidateComponentProviders with Environments to make sure they only find components matching the environment.

Retain the old constructor by defaulting to the Environment the ResourceLoader potentially contains or even a StandardEnvironment in worse cases. This is primarily to not break existing clients. Those should be upgraded to use the new constructor, of course.

Needed to add an additional guard in BeanDefinitionRegistrarSupport as Spring 3.2.8 fails to invoke EnvironmentAware (filed SPR-11744 for that). This should be removed once we upgrade to Spring 3.2.9.

Related pull request: #80.
Related tickets: DATACMNS-493, DATACMNS-494, SPR-11744.
2014-04-29 08:03:58 +02:00
Spring Buildmaster
05224796ee DATACMNS-488 - Prepare next development iteration. 2014-04-15 14:12:02 +02:00
Spring Buildmaster
5701ca4df0 DATACMNS-488 - Release version 1.7.2.RELEASE (Codd SR2). 2014-04-15 05:07:55 -07:00
Oliver Gierke
102a73b925 DATACMNS-488 - Prepare 1.7.2.RELEASE (Codd SR2).
Upgraded to Spring Data Build 1.3.2.RELEASE, switched to release repository and updated changelog, notice and readme.
2014-04-15 14:02:58 +02:00
Oliver Gierke
3982e80f90 DATACMNS-478 - Allow build to be run on Java 8.
Introduced XmlUnit to make sure we can test XML rendering Java 6, 7 and 8.
2014-04-15 09:47:37 +02:00
Oliver Gierke
275bb8e410 DATACMNS-485 - Fixed false negative type alias detection in MappingContextTypeInformationMapper.
MappingContextTypeInformationMapper now considers the raw type only for type alias conflict detection.
2014-04-15 07:48:41 +02:00
Oliver Gierke
02046dac6a DATACMNS-485 - Fixed bug in ParameterizedTypeInformation.hashCode().
Previously, ParameterizedTypeInformation.hashCode() had been inconsistent to equals in case of a fully resolved parameterized type. This is now fixed by not including the parent reference in case a parameterized type is resolved completely.

Also, TypeDiscoverer.getActualType() does not return the component type for non-collection/non-maps anymore to make sure we don't accidentally unwrap parameterized types.
2014-04-02 10:00:09 +02:00
Dave Syer
b3ae206913 DATACMNS-484 - Fix grammar in exception message of RepositoryFactorySupport.
Original pull request: #78.
2014-04-01 18:31:17 +02:00
Oliver Gierke
df16f9535c DATACMNS-479 - Make sure Map types are not added to the mapping context.
Changed the algorithm for nested PersistentEntity detection to only use PersistentProperty.getPersistentEntityTypes(…) and make sure we return unwrap Maps and Collections inside the method correctly.
2014-03-27 12:24:46 +01:00
Oliver Gierke
cb40c4e660 DATACMNS-477 - PageableHandlerMethodArgumentResolver now handles null default.
We now explicitly check for the configured default being null and subsequently return that value if we don't have both the page and the size parameter configured.
2014-03-26 18:23:31 +01:00
Spring Buildmaster
e2c4fb9ca8 DATACMNS-449 - Prepare next development iteration. 2014-03-13 09:44:35 +01:00
Spring Buildmaster
ce114422be DATACMNS-449 - Release 1.7.1.RELEASE (Codd SR1). 2014-03-13 01:40:41 -07:00
Christoph Strobl
f14f3fd0c3 DATACMNS-449 - Prepare 1.7.1.RELEASE (Codd SR1).
Update pom.xml to use Spring Data Build parent in 1.3.1.RELEASE as well as the release repository. Update changelog to reflect recent changes / releases. Update notice. Update links in readme to point to spring.io.

Original Pull Request: #74.
2014-03-13 09:36:39 +01:00
Oliver Gierke
7625dd30a0 DATACMNS-466 - More aggressive checks for the correct Spring version.
We now actively check that the a method in a Spring class we rely on to be public actually is public and throw an exception pointing to the offending JAR in an exception that's thrown otherwise.
2014-03-11 12:28:34 +01:00
Oliver Gierke
88af0cb00b DATACMNS-465 - Polished template.mf. 2014-03-07 08:06:35 +01:00
Oliver Gierke
dbb7c355ee DATACMNS-462 - AbstractPersistentProperty considers collections and maps entities now.
Removed the rejecting check for collections and maps and solely rely on the evaluation of the actual type for the ….isEntity() decision in AbstractPersistentProperty. This will cause collection and map properties also being inspected for persistent types as soon as the owner type gets added to the mapping context.
2014-03-06 08:43:57 +01:00
Michael Hunger
0464d93a29 DATACMNS-447 - Soften too strict strickt-check in MappingContext.
Previously we directly threw a MappingException in MappingContext.getPersistentEntity(TypeInformation) when the MappingContext was in strict mode and we were given a TypeInformation for which we didn't have a PersistentEntity already.

We now first check whether we should actually create a PersistentEntity for the given TypeInformation if no PersistentEntity is available, before throwing a  MappingException - if we should not then we simply return null (e.g. for simple types like Integer or Double).

Original pull requests: #66, #71.
2014-03-05 11:37:32 +01:00
Oliver Gierke
4a3af27934 DATACMNS-460 - Repository metadata now supports array return types for query methods.
Added array checks to AbstractRepositoryMetadata.getReturnedDomainClass() to detect array component types. QueryMethod now considers methods returning arrays to be collection query methods.
2014-03-05 08:27:46 +01:00
Fabian Buch
10847d3867 DATACMNS-453 - Fix NPE in isPageableRepository() for Repositories without a findAll() method.
Added additional null check to isPagingRepository() to handle repository definitions that do not have a findAll method.

Original pull request: #69.
2014-02-26 15:14:39 +01:00
Spring Buildmaster
7e99eaaf01 DATACMNS-443 - Prepare next development iteration. 2014-02-24 14:01:52 +01:00
Spring Buildmaster
a9fb7070c8 DATACMNS-443 - Release version 1.7.0.RELEASE. 2014-02-24 04:46:40 -08:00
Oliver Gierke
91e693b9da DATACMNS-443 - Prepare 1.7.0.RELEASE. 2014-02-24 13:10:02 +01:00
Oliver Gierke
ab37869a1a DATACMNS-446 - Added toString() methods to TypeInformation types. 2014-02-23 13:51:41 +01:00
Thomas Darimont
71169ca160 DATACMNS-445 - Documentation overhaul.
Updated links and vendor-information in readme. Updated author information. Fixed some typos, added ids to sections updated examples and descriptions. Added and referenced description of repository populator namespace element.

Original pull request: #65.
2014-02-21 13:39:22 +01:00
Oliver Gierke
4cee676608 DATACMNS-444 - DefaultPersistentPropertyPath now skips null converted names.
If a Converter handed into DefaultPersistentPropertyPath.toDotPath(…) returns null or an empty string for a mapped property name, that value is skipped during path construction.
2014-02-19 18:10:02 +01:00
Oliver Gierke
f089acb17e DATACMNS-442 - Improved documentation to mention @NoRepositoryBean. 2014-02-19 14:47:12 +01:00
Oliver Gierke
611c6194f4 DATACMNS-442 - Added test case to show that id resolution succeeds for intermediate repositories.
Adapted test case failing on Spring 4 due to eager RepositoryMetadata resolution.
2014-02-19 14:01:30 +01:00
Thomas Darimont
f047cce7c3 DATACMNS-441 - Fixed potential NullPointerException in query method detection on Java 8 compiled code.
We now skip bridge methods for query method processing in order to circumvent the changed behavior of Class#getMethods() in Java 8 (when the code was compiled with target byte code level 1.8). On Java 8 this results in bridge methods being found and inspected for query method annotations. Since we currently cannot analyze generic return types of bridge methods this results in NullPointerExceptions being thrown at a later stage in AbstractRepositoryMetadata#getReturnedDomainClass(…).

Original pull request: #64.
Related issue: DATAJPA-465.
2014-02-19 09:30:58 +01:00
Oliver Gierke
931a697ec5 DATACMNS-440 - Fixed map value type resolving for Map value types.
Previously the map value type resolving algorithm checked the value type to be of type Map again to shortcut the resolution. We now weakened this to an assignment check and eagerly resolve the generic type if its bound on exactly that level already. If no concrete type argument can be found, we fall back to the general generics resolution mechanism.
2014-02-13 12:06:26 +01:00
Oliver Gierke
20846809e1 DATACMNS-439 - AnnotationRepositoryConfigSource now evaluates REGEX and ASPECTJ filters.
We now leniently detect AspectJ and regular expression filters in an @Filter annotation in @Enable…Repositories annotations.
2014-02-12 12:18:24 +01:00
Oliver Gierke
d1faa7187d DATACMNS-432 - Fix regression in Repositories.
The changes in 899cf25 causes Repositories not finding any repository instances in case the lookup of beans by type for RepositoryFactoryInformation if the initialization causes as cyclic reference. Even worse, we might run into cases in which the attempt to access the beans by type causes transitive object creation which results in a successful lookup on a second attempt.

This is effectively caused by the catch-block in DefaultListableBeanFactory.getBeansOfType(…) which registers the suppressed exception as the method is used for lookup the beans for injection points with Lists and Maps.

We now explicitly look for bean names first and access the bean by name afterwards, which guarantees the exception to be thrown if it occurs. This will reveal the underlying issue and let user potentially deal with it. It's generally recommended to refer to Repositories in a very lazy fashion (using Provider<T>, ObjectFactory<T> or @Lazy on the injection point as of Spring 4) to avoid creating circular dependencies through by-type-lookups.
2014-02-12 10:24:37 +01:00
Oliver Gierke
1e3640e0ee DATACMNS-436 - Order.equals(…) / hashCode() / toString() now consider ignore case flag.
Extended equals(…), hashCode() and toString() methods t consider the ignore case flag held in an Order instance.
2014-02-06 18:13:54 +01:00