110,571
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spring.Context;
using Spring.Context.Support;
namespace HelloWorld
{
class Program
{
static void Main(string[] args)
{
IApplicationContext context = ContextRegistry.GetContext();
Hello hello = (Hello)context.GetObject("hello");
System.Console.Out.WriteLine(hello.HelloWord);
System.Console.In.Read();
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="spring">
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
</sectionGroup>
</configSections>
<spring>
<context>
<resource uri="config://spring/objects"/>
</context>
<objects xmlns="http://www.springframework.net">
<object id="hello" type="HelloWorld.Hello">
<property name="HelloWord" value="Hello!Welcome to Spring.Net Word!"/>
</object>
</objects>
</spring>
</configuration>