Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在SpringContext中加载Beans属性_Spring - Fatal编程技术网

如何在SpringContext中加载Beans属性

如何在SpringContext中加载Beans属性,spring,Spring,我想根据作为输入接收的对象更新spring应用程序上下文中bean的属性 There are many other beans here only required beans. <bean id="getReportParameterWithDetailsBean" class="com.oracle.xmlns.oxp.service.publicreportservice.GetReportParameters"> <property name="reportReq

我想根据作为输入接收的对象更新spring应用程序上下文中bean的属性

There are many other beans here only required beans.
<bean id="getReportParameterWithDetailsBean" class="com.oracle.xmlns.oxp.service.publicreportservice.GetReportParameters">
   <property name="reportRequest" >
        <ref bean="reportRequestWithDetails"/>
    </property>
    <property name="userID"  value = "#{userDetails.userId}" />
    <property name="password"  value = "#{userDetails.password}" />
</bean>

 <bean id ="userDetails" class="com.oracle.xmlns.oxp.service.DataObjects.UserDetails">
    <property name="userId"  value = <Get the values from Reciever BEan> />
    <property name="password"  value = <Get the values from Reciever BEan> />
Receiver类的runARG是从外部组件调用的,该组件为我提供UserDetails对象,我需要在上面显示的xml代码段中设置它。
请帮助我实现这一点。提前感谢

您是否有要更新代码的设置器?bean是与Spring连接的常规Java类。您可以使用
setter
方法设置
getReportParameterWithDetailsBean
bean的值。因为它是单例bean,所以当您再次请求它时,它的值将得到反映。请提供
GetReportParameters
类的源代码和加载示例应用程序上下文和数据输入。问题很清楚,但不是你们到目前为止做了什么。
}

public PublicReportServiceClientReciever(UserDetails userDetails){
    this.user=userDetails;
}
private UserDetails user;

public UserDetails getUser() {
    return user;
}
public void setUser(UserDetails user) {
    this.user = user;
}

public void runARG(UserDetails userDetails){
    ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

    this.user = userDetails;
    //GetReportParameters will intuen be used in this bean  PublicServiceReportReadWithDetails  
    PublicServiceReportReadWithDetails reader = new PublicServiceReportReadWithDetails();
    reader.readreports();
    ((ClassPathXmlApplicationContext) context).close();
}