Spring.NET XML Configuration File

A sample Spring.net configuration file looks like this

<?xml version="1.0" encoding="utf-8" ?>

<object id="Pen" type="Spring4.Pen, Spring4" />
<object id="Pencil" type="Spring4.Pencil, Spring4" />

Lets decompose it

It must start with <?xml version=”1.0″ encoding=”utf-8″ ?> because it is a standard xml file.

It must have xmlns=”http://www.springframework.net&#8221; namespace and possibly other if you need more features.

<object> refers to a C# class. It is same as bean in JavaWorld.

<propery> means C# property. I can take either value=”” argument, which is a string or a ref=”ID” which is an ID of another object in the XML. It is used for Setter Injection by Spring.NET

<constructor-arg> is used for Constructor Injection. It can also either take a value argument or a ref argument, just like the property. Value is a string and ref is ID of another object.


This entry was posted in Software Development. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s