You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Datacouch 550 autoindex not working in spring boot app (#295)
* DATACOUCH-550 Autoindexing only works from SpringJunitConfig
Due to the interdependency in bean creation, Autoindexing does not
work in a normal spring-boot application. This change overrides
the addPersistentEntity and getPersistentEntity of CouchbaseMappingContext
to avoid entries cached before the indexCreator was listening from
preventing MappingContextEvents from being published after the indexCreator
is listening. It also exposes the indexCreators classesSeen map so that
MappingEvents for an entity are not re-published after the indexCreator
has seen them.
* DATACOUCH-550 - Autoindexing does not work spring-boot application.
Due to the interdependencies of beans, autoindexing does not work
in the startup of a normal spring-boot application. Processing of
entities occurs during the initialization of CouchbaseMappinContext,
which occurs before initialization of MappingCouchbaseConverter,
which occurs before the initialization of CouchbaseTemplate -
which creates the indexCreator listener. So when the
AbstractMappingContext (CouchbaseMappingContext) is publishing
MappingContextEvents - there is not yet any indexCreator.
And subsequent processing of entities finds the entities cached,
and therefore does not publish MappingContextEvents. This change
overrides the addPersistentEntity() and getPersistentEntity()
methods of AbstractMappingContext such that caching does not
preven the MappingContextEvents from being published. This change
also exposes indexCreator classesSeen map to CouchbaseMappingContext
so that once an entity has been processed by indexCreator, it is
not published again.
Autoindexing by SpringJUnitConfig did work prior to this change.
Co-authored-by: mikereiche <michael.reiche@couchbase.com>
0 commit comments