4
回答
Spring.net 查询方法注入设置问题(Lookup Method Injection)
终于搞明白,存储TCO原来是这样算的>>>   

<object id="CreateUserFromConstructor" type="Dao.Entities.User, Dao" singleton="false">
    <constructor-arg name="id" type="string" value="Example" />
    <constructor-arg name="userId" type="string" value="Example" />
    <constructor-arg name="userName" type="string" value="Example" />
    <constructor-arg name="userPwd" type="string" value="Example" />
    <constructor-arg name="state" type="string" value="Example" />
  </object>

  <object id="CreateDepartment" type="Dao.Entities.Department, Dao" singleton="true">
    <lookup-method name="CreateUserHelper" object="CreateUserFromConstructor" />
    <property name="ID" value="Example" />
    <property name="DepartmentId" value="Example" />
    <property name="DepartmentName" value="Example" />
    <property name="Manager" ref="CreateUserFromConstructor" />
  </object>

 

配置文件如上,底下的singleton对象里依赖一个非singleton对象,按照spring.net里说的应该使用lookup-method解决,但设置后总是报下面这些

 

The element 'object' in namespace 'http://www.springframework.net' has invalid child element 'property' in namespace 'http://www.springframework.net'. List of possible elements expected: 'lookup-method, replaced-method, listener' in namespace 'http://www.springframework.net

 

求高人解答

举报
王晓嘉
发帖于7年前 4回/1K+阅
顶部