Solved

injecting property through spring applicationContext.xml

Posted on 2011-03-11
3
559 Views
Last Modified: 2012-08-13
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
Comment
Question by:gudii9
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 167 total points
ID: 35107947
Property is null by default so no need inject anything.
0
 
LVL 20

Assisted Solution

by:Sathish David Kumar N
Sathish David  Kumar N earned 166 total points
ID: 35111390
factory-bean/factory-method doesn't work with null value so it will error.
0
 
LVL 2

Assisted Solution

by:brain_box
brain_box earned 167 total points
ID: 35114772
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question