Solved

injecting property through spring applicationContext.xml

Posted on 2011-03-11
3
565 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
hibernate jars 4 58
ejb wildfly example 2 72
Why doesn't this text field show up on my Applet frame? 2 28
glassfish admin console 1 21
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

756 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