Repository navigation
Document 3.0 lifecycle listeners - #24
Merged
Merged
Conversation
Covers the per-event listener interfaces (#4432), configured global listeners (#4431), and the Document listener variants and addInterceptor removal (#4429): life-cycle-methods is rewritten, configuration gains morphia.listeners, migrating gains an entity-listeners section, and the complete config example is synced with the generated one. The DigitalSigner example now signs the encoded document in a PostPersistDocumentListener instead of the empty one @PrePersist was given.
There was a problem hiding this comment.
🟡 Changes recommended
The lifecycle documentation omits the EntityListener interface requirement for annotated-only listeners and the no-argument-constructor requirement for entities whose callbacks come solely from @EntityListeners.
2 open issues
What changed in this PR
Updates the Morphia 3.0 documentation for the new lifecycle listener interfaces and configuration-based registration.
Changes:
- Rewrites lifecycle guidance, including document access, callback ordering, and the corrected signing example.
- Adds listener migration guidance and global listener configuration instructions.
- Synchronizes the complete configuration example with the listener and decode-session cache settings.
| File | Description |
|---|---|
content/morphia/3.0/migrating.md |
Explains listener API migration, removed methods, and recipe limitations. |
content/morphia/3.0/life-cycle-methods.md |
Documents listener interfaces, registration, timing, and examples. |
content/morphia/3.0/examples/complete-morphia-config.properties |
Adds listener and decode-session cache settings. |
content/morphia/3.0/configuration.md |
Introduces global listener configuration and links to lifecycle guidance. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Documents the listener changes from MorphiaOrg/morphia#4432, #4431 and #4429 for 3.0.
Changes
life-cycle-methodsis rewritten:@EntityListenersclass;Document(PostPersistDocumentListener,PreLoadListener,PostLoadDocumentListener);morphia.listenersandMorphiaConfig.listeners(...));Documentout is cheaper;@PreLoadordering for constructor-built entities such as records.DigitalSignerexample is fixed. It signed theDocumentin@PrePersist, where it's still empty, so it signed nothing. It now signs the encoded document in aPostPersistDocumentListener. The claim that@PrePersistcan return a replacementDocumentis gone too; return values were never used.configurationgains amorphia.listenerssection, linking to the details.migratinggains a 3.0 entity-listeners section:EntityListenermethods to the new interfaces;Mapper.addInterceptor,getListeners()andhasListeners();UpgradeToMorphia30migrates, and what it marks for a person;@PreLoadordering change.complete-morphia-config.propertiesis synced with the one generated on morphia's master. That addsmorphia.listeners, and also the existingmorphia.decode-session-cache-size, which the docs copy was missing.Checked
hugobuilds. The new sections' anchors and the#global-listenerscross-link resolve. The javadoc links use the same++javadoc/...++form as the existing pages, which render it the same way.