简体   繁体   English

Spring MVC在类“ xxxx”中找不到属性“ xxxx”的设置器

[英]Spring MVC no setter found for property 'xxxx' in class 'xxxx'

I'm getting four 'no setter found for property 'xxxx' in class com.rusapp.batch.trans.OLFMWriter'. 我在com.rusapp.batch.trans.OLFMWriter类中得到了四个“找不到属性'xxxx”的设置器。 A fifth bean in that class does not have an error, inputQueue. 该类中的第五个bean没有错误inputQueue。 The rest have errors in the xml below at each of the property lines. 其余的每个属性行下面的xml中都有错误。

The beans appear as such: 豆显示如下:

<bean id="inputQueue" class="com.rusapp.batch.trans.OLFMWriter">
    <property name="inputQueue" value="${${ENV}_MQ_FM_INPUT_QUEUE}" />
</bean>

<bean id="replyQueue" class="com.rusapp.batch.trans.OLFMWriter">
    <property name="replyQueue" value="${${ENV}_MQ_FM_REPLY_QUEUE}" />
</bean>

<bean id="mqConnectionFactory" class="com.rusapp.batch.trans.OLFMWriter">
    <property name="mqConnectionFactory" ref="mqConnection" />
</bean>

<bean id="JMSDestination"
    class="com.rusapp.batch.trans.OLFMWriter">
    <property name="JMSDestination" ref="jmsDestinationResolver" />
</bean>

<bean id="JMSReplyTo"
    class="com.rusapp.batch.trans.OLFMWriter">
    <property name="JMSReplyTo" ref="jmsDestinationResolverReceiver" />
</bean>

The setters in the class appear as follows: 该课程中的设置者如下所示:

public static void setMqConnectionFactory(MQConnectionFactory _mqConnectionFactory) {
    OLFMWriter._mqConnectionFactory = _mqConnectionFactory;
}
public static void setReplyQueue(String _replyQueue) {
    OLFMWriter._replyQueue = _replyQueue;
}
public static void setJMSDestination(Destination _JMSDestination) {
    OLFMWriter._JMSDestination = _JMSDestination;
}
public static void setJMSReplyTo(Destination _JMSReplyTo) {
    OLFMWriter._JMSReplyTo = _JMSReplyTo;
}
public void setInputQueue(String inputQueue){
    _inputQueue = inputQueue;
}

This is not my code and I'm not too knowledgeable with Spring yet but I can't find anything wrong with the setter names. 这不是我的代码,我对Spring也不是很了解,但是我找不到setter名称有什么问题。 I thought it was a workspace error but they have persisted through several restarts of Eclipse. 我以为这是一个工作区错误,但是它们在Eclipse的几次重新启动后仍然存在。

Can anyone find any obvious faults with this code? 任何人都可以使用此代码找到任何明显的错误吗?

Your setters are static which means that they don't conform to the java beans specification. 您的设置器是静态的,这意味着它们不符合Java Bean规范。

I think you'll want to use a MethodInvokingFactorybean instead. 我认为您将改为使用MethodInvokingFactorybean

<bean abstract="true" id="abstractParent" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetClass" value="com.rusapp.batch.trans.OLFMWriter"/>
</bean>
<bean id="inputQueue" parent="abstractParent">
    <property name="staticMethod" value="setInputQueue" />
    <property name="arguments">
        <list><value>${${ENV}_MQ_FM_INPUT_QUEUE}</value></list>
    </property>
</bean>
<bean id="replyQueue" parent="abstractParent">
    <property name="staticMethod" value="setReplyQueue" />
    <property name="arguments">
        <list><value>${${ENV}_MQ_FM_REPLY_QUEUE}</value></list>
    </property>
</bean>
etc...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring Data Neo4j存储库组合错误:找不到类型为YYYY的属性XXXX - Spring Data Neo4j Repository Composition error: No property XXXX found for type YYYY JPA spring boot,通过持久属性的反射访问字段XXXX时出错 - JPA spring boot, Error accessing field XXXX by reflection for persistent property 在类*中找不到属性*的二传手 - No setter found for property * in class * org.springframework.beans.NotWritablePropertyException:bean类的属性&#39;xxxx&#39;无效: - org.springframework.beans.NotWritablePropertyException: Invalid property 'xxxx' of bean class : Bean属性&#39;xxxx不可读或具有无效的getter方法:getter的返回类型是否与setter的参数类型匹配 - Bean property 'xxxx is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter dlopen(&quot;xxxx&quot;) 失败:dlopen 失败:未找到库“xxxx” - dlopen("xxxx") failed: dlopen failed: library "xxxx" not found 在类中找不到属性“ dataSource”的设置器 - No setter found for property 'dataSource' in class 用户缺少权限或找不到对象:XXXX - user lacks privilege or object not found: XXXX 在会话中保存对象时,将在类XXXX中抛出非法ArgumentException - On Saving the Object in session throws illegalArgumentException in class XXXX 找不到类Spring MVC - Class not found Spring MVC
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM