Migrating from v5.1 to v5.2
Version 5.2 brings some breaking changes to certain components. This document provides a migration guide for these changes. For all the new features, see the release notes.
Custom ID types across multiple components using ResourceIDMapper and ResourceIDProvider
Working with the id of a resource is needed across various components in the framework.
Until this version, the components provided by the framework assumed that you could easily
convert the id of a resource into a String representation. For example,
BulkDependentResources
worked with a Map<String,R> of resources, where the id was always of type String.
Mainly because of the need to manage external dependent resources more elegantly,
we introduced a cross-cutting concept: ResourceIDMapper,
which gets the ID of a resource. This is used across various components, see:
ExternalResourceCachingEventSourceExternalBulkDependentResourceAbstractExternalDependentResourceand its subclasses.
We also added ResourceIDProvider,
which you can implement in your Pojo representing a resource.
The easiest way to migrate to this new approach is to implement this interface for your (external) resource
and set the ID type generics for the components above. The default implementation of the ResourceIDMapper
works with ResourceIDProvider (see related implementation).
If you cannot implement ResourceIDProvider because, for example, the class that represents the external resource is generated and final,
you can always set a custom ResourceIDMapper on the components above.
See also:
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.