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
{{ message }}
Repository navigation
Add a way to specify "inject-only" with @JacksonInject #1381
Currently all injectable properties also allow binding of data from input, so if there is a JSON value for property, it will override anything injected. But this may not always be what user wants; sometimes it may be preferable to only use injection (and quietly drop value from data, if any). Or possible even reverse, that is, allowing injection to optional override value, but if no injectable value given to default to value from input data.
To support this change, some other changes are needed:
Create JacksonInject.Value to contain aspects (name, precedence for now, possibly more in future)
Create a new enum type for JacksonInject to indicate if and how input data value is to be used.
Change introspection method in AnnotationIntrospector to produce new value object but allow chaining with old implementations, to support some level of interoperability
Change introspectors (Guice module uses one I think; OSGi too?)
As to enum to use (JacksonInject.Input?), perhaps:
Primary: (default) if input data has property, use that, not injected value
Secondary: input data only used if no injected value can be found
Never: input data never used, only injected value
Another possible improvement could be to add another property (required?) to indicate whether it is acceptable to not have an injectable value defined, when one is needed (which is in all cases except with Primary, and finding actual data).
If no value is found, and injection is NOT required (required would be the default for now) null would be injected.
Reacted by Dunemaster, branyas, Tamasster, Daniel Wegener and Himanshu
Note: for 2.x light-weight solution via #1565, but need to rewrite for 3.0 to do proper checking, if (and only if) we can keep track of actual declaration location.
Activity
Start work on #1381
Bit more refactoring to prepare for #1381
cowtowncoder commentedon Apr 6, 2018
Note: for 2.x light-weight solution via #1565, but need to rewrite for 3.0 to do proper checking, if (and only if) we can keep track of actual declaration location.
Marcono1234 commentedon Apr 5, 2021
Has this been partially solved through FasterXML/jackson-annotations#120?
cowtowncoder commentedon Apr 5, 2021
Annotation issue can only add new properties but not actual handling (package only contains annotation declarations/definitions).
12 remaining items
feat(FasterXML#1381): always adding properties annotated with Jackson…
Partial commit of #5175 (for #1381)
refactor(FasterXML#1381): changing exception message in ValueInjector…
chore(FasterXML#1381): minor comment update
fix(FasterXML#1381): avoid duplicate injection on constructor properties
feat(#1381): Add a way to specify "inject-only" with @JacksonInject (#…
Fix issues wrt #1381
Fix issues wrt #1381 (#5392)
cowtowncoder commentedon Nov 16, 2025
Implemented for 2.21(.0).
Preserve @JacksonInject metadata in GuiceAnnotationIntrospector
build(deps): Bump jackson to `2.21.3` (#19528)