injecting property through spring applicationContext.xml


can we inject null list collection object while injecting property through applicationContext.xml bean id definition within propery attribute. Any ideas, suggestions, sample code, resources, links highly appreciated. thanks in advance
Who is Participating?
objectsConnect With a Mentor Commented:
Property is null by default so no need inject anything.
Sathish David Kumar NConnect With a Mentor ArchitectCommented:
factory-bean/factory-method doesn't work with null value so it will error.
brain_boxConnect With a Mentor Commented:
You are not obligated to define all fields of a class in spring-config. If it is a must to define them in the config, you can utilize the NULL Object pattern. This is a better way of handling null values and also to avoid null pointers at runtime.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.