Spring配置文件加载时出现Bean property 'newscontentDAO' is not writable or has an invalid setter method错误的解决

    技术2022-05-11  81

    因为Spring要求注入的成员变量要按照sun的命名规范,所以,注入 变量名必须首字母小写<property name="target">          <bean class="com.bjjdsy.ky.zl.service.StationServiceImpl">            <property name="stationDAO">                <ref bean="StationDAO"/>           </property>          </bean> </property>

     

    StationServiceImpl 中要这样定义 stationDAOprivate StationDAOImpl stationDAO;

     

    注意,其中 stationDAO必须首字母小写,否则会提示不可写或者没有setter方法

     

    Spring真是严谨


    最新回复(0)