We move away from Maven version ranges as they complicate the build and dependency resolution process. They make the build in-reproducible. Users stuck with a 3.0.x version of Spring will now have to manually declare Spring dependencies in their needed 3.0.x version. Not that at least Spring 3.0.7 is required currently.
Before actually adding a type as PersistentEntity, AbstractMappingContext will call shouldCreatePersistentEntityFor(TypeInformation<?> type) now. The default implementation will just consider the SimpleTypeHolder for that decision. However as adding a Converter to the context will render the converted object to be treated as simple, one might want to override this method to be more precise and only rule out store-specific simple types at this stage.
ClassTypeInformation does not resolve nested array types anymore as a multidimensional array in fact has a component type of an array of one dimension less, e.g. String[][].getComponentType() -> String[].
There have been a few dependencies which we depended on on compile time but which were pulled into the classpath transitively. Declaring these dependencies now explicitly. Keeping them optional to allow minimal footprint.
Merged mapping.context and mapping.event packages. Moved MappingContext event into context package. Updated Sonargraph architecture description and completed package and dependency mapping.
If an @EnableRepository annotation does not carry an @Inherited annotation and the annotation is used in a JavaConfig inheritance scenario the ImportBeanDefinitionRegistrar gets invoked without the annotation metadata available. The RepositoryBeanDefinitionRegistrarSupport now guards against that case and will not invoke registration of repository bean definitions. It's strongly recommended to equip @EnableRepository annotations with @Inherited to accommodate this scenario.
Added guards to PropertyDescriptor access to prevent NullPointerExceptions in cases it is not given in the first place. Polished JavaDoc for test case.
MappingContextEvent now has an wasEmittedBy(MappingContext<?, ?> context) method to allow identifying whether the event was emitted by the given MappingContext. Useful if multiple MappingContexts are in place and one wants to react on the events emitted by a particular one only.
PersistentProperty now exposes getGetter() and getSetter() methods which restrict the methods being returned to return or accept type compatible values to the actual properties type. Thus when you implement a custom getter or setter which - by the definition of the JavaBean spec - would qualify as read or write method for a particular property, we now ensure that they are only considered if they match the type of the field exposed.
The section on the repository exporters contained a code sample using language="javascript". As the highlighting in the docbkx plugin doesn't support javascript as language it will break the build of other reference documents including this one. Removed the language attribute for this sample entirely.
Completely rewrote namespace bean definition parsing to be extendable more easily. Separated XML concerns from annotation based configuration. The central point to extend the namespace parsing for a certain module is now hidden behind the RepositoryConfigurationExtension interface (have a look at the RepositoryConfigurationExtensionSupport base class as well).
The id properties are now discovered by the BasicPersistentEntity during the call to addPersistentProperty(…). Beyond that the method rejects the id property if one was already set.
Added RepositoryPopulator abstraction and implementations based on Spring OXM Unmarshallers as well as Jackson. This allows arbitrary repositories being populated with data pulled from XML / JSON, no matter what store they are actually backed. The populator will eventually populate the repositories held in a Repositories instance. It can be used like this:
Repositories repositories = new Repositories(applicationContext);
ResourceReader reader = new JacksonResourceReader();
ResourceReaderRepositoryPopulator populator = new ResourceReaderRepositoryPopulator(reader);
populator.setResourceLocation("classpath*:data.json");
populator.populate(repositories);
The ResourceReader defines what technology shall be used to read the data from the file into objects. The ResourceReaderRepositoryPopulator uses the reader and can either get a set of Resource instances configured or is able to lookup resources using a location string. The actual Repositories instance captures all CrudRepository instances contained inside an ApplicationContext.
The populators can also be used from within XML configuration though the repository namespace elements shown below:
<repository:jackson-populator location="classpath:org/springframework/data/repository/init/data.json" />
<repository:unmarshaller-populator location="classpath:org/springframework/data/repository/init/data.xml" unmarshaller-ref="unmarshaller" />
Updated reference documentation accordingly.
So far we have considered Java transient fields as transient through the isTransient() method on PersistentProperty. This resulted in the properties not being persisted eventually. We now consider all fields as non-transient by default as we actually have to persist them as the object cannot be re-created completely without doing so as the usage of the transient keyword might rely on the readObject(…) method inside the object which would actually reconstitute the transient field's state but we of course cannot call this method actually.
So far the domain classes to be added to the mapping context initially were added in afterPropertiesSet() of InitializingBean. This had the drawback that although the MappingContext is already set up properly the actual listeners of the events fired (e.g. index creating ones) might not have been set up properly. We list to the ContextRefreshedEvent indicating the entire ApplicationContext being set up completely. Thus all infrastructure components are set up properly and the timing issues doesn't exist anymore.
Introduced PropertyReferenceException to capture the invalid property and the base PropertyPath a property expression could be resolved into. Introduced getLeafProperty() to be able to access the leaf property of a property path being created.
Fixed minor performance problems discovered by the fix for DATAMONGO-439. We're now caching the information whether a constructor parameter is an enclosing class parameter. PersistentEntityParameterValueProvider is throwing an exception now if the parameter is not referring to a property of the entity (via the parameter name).