• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 586
  • Last Modified:

injecting property through spring applicationContext.xml

Hi,

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
0
gudii9
Asked:
gudii9
3 Solutions
 
objectsCommented:
Property is null by default so no need inject anything.
0
 
Sathish David Kumar NCommented:
factory-bean/factory-method doesn't work with null value so it will error.
0
 
brain_boxCommented:
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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now