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>
为什么总是报异常呢???
总是说Spring.Context.Support.ContextRegistry”的类型初始值设定项引发异常
郁闷一天了哪位大侠帮帮忙啊!!
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>
为什么总是报异常呢???
总是说Spring.Context.Support.ContextRegistry”的类型初始值设定项引发异常
郁闷一天了哪位大侠帮帮忙啊!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货