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

运行Javaweb项目的时候出现这个问题

problem:Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginMapper' defined in file [G:\2017课程设计\cherry\project_manager\out\artifacts\project_manager_war_exploded\WEB-INF\classes\spring\spring-mybatis.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'mapperInterface ' of bean class [org.mybatis.spring.mapper.MapperFactoryBean]: Bean property 'mapperInterface ' is not writable or has an invalid setter method. Did you mean 'mapperInterface'?

我检查了很久,添加了之前有人说的default-autowire="byName",没用,也检查了数据库的链接,发现和数据库暂时没有关系,

但是我注意到了 not writable or has an invalid setter method,我又重新检查了我的配置文件发现

<bean id="loginMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
    <property name="mapperInterface " value="com.electric.mappers.LoginMapper">property>
    <property name="sqlSessionFactory" ref="sqlSessionFactory">property>
bean>

不知道大家有没有发现,在mapperInterface的后面多了一个空格,之后我把那个空格去掉就可以了,希望能给大家帮助。同时也提醒大家认真检查

你可能感兴趣的:(javaweb项目问题解决)