1

春のバージョン: 2.0.0.40000 ランタイム: .NET 4.5

ここ www.springframework.net/.../objects.htmlと API http://springframework.net/docs/1.3..../webframe.htmlに示されている例を取る- ContextHandler

私は次のものを持っています

コード:

<configSections>
  <sectionGroup name="spring">
    <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
    <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core" />
    <sectionGroup name="child">
    <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
    </sectionGroup> 
  </sectionGroup> 
</configSections>

<spring>
  <objects xmlns="http://www.springframework.net">
    <import resource="assembly://ProjectDLL/Config/Spring.xml"/> 
  </objects>

  <child>
    <objects xmlns="http://www.springframework.net">
      <object name="eventLog"
          type="System.Diagnostics.EventLog, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
          >
        <constructor-arg type="string" name="logName" value="v1"  />
        <constructor-arg type="string" name="machineName" value="."  />
        <constructor-arg type="string" name="source" value="v1"  />
      </object>
    </objects>
  </child>  

  <context name="Parent">
    <resource uri="config://spring/objects"/>
    <context name="child">
    <resource uri="config://spring/child/objects"/>
    </context>
  </context>
</spring>

通話中

ContextRegistry.GetContext();

コンテキスト名の結果は

メッセージ --- コンテキスト 'ChildContext' の作成中にエラーが発生しました: オブジェクト ファクトリの後処理中にエラーが発生しました。

Child、ChildContext、Children を含むさまざまな名前付けをすべて試しましたが、すべて同じエラーが発生しました。

この例では、オブジェクト ( ) を含むリソース ファイルを使用しています。独自の XML ファイルをインポートしない場合、XML ファイルは機能しますが、インポートすると子が機能しません。同じ xml ファイルで子を定義すると、「コンテキスト '親' の作成中にエラーが発生しました: ルート要素が複数あります」というメッセージが表示されます。

これは構成の問題である可能性が最も高いことを知っており、助けていただければ幸いです。

4

1 に答える 1