Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException:

后端 未结 2 1082
面向向阳花
面向向阳花 2021-01-03 00:04

I was trying to get data from a MySQL database using the Spring utility ResultSetExtractor, but I got the following exception:

Exception in thre         


        
相关标签:
2条回答
  • 2021-01-03 00:18

    Controller extends MethodNameResolver

    public final void setMethodNameResolver(
            MethodNameResolver methodNameResolver) {
        this.methodNameResolver = methodNameResolver;
    }
    
    public final MethodNameResolver getMethodNameResolver() {
        return this.methodNameResolver;
    }
    

    remove spring Annotation like @controller @AutoWired

    0 讨论(0)
  • 2021-01-03 00:24

    The problem is in

    <bean id="edao" class="org.resultset.EmployeeDao">
    <property name="jdbcTemplate" ref="jdbcTemplate"></property>
    </bean>

    Try changing the name="jdbcTemplate" to name="template". Since you have given name as jdbcTemplate spring will search for a setter method with name setJdbcTemplate() in EmployeeDao class, but the acutal method you have is setTemplate()

    0 讨论(0)
提交回复
热议问题