今天在用Spring框架的时候发现在进行强制类型转化的时候我把Object[]数组强制类型转换成Sting[]失败。报告的错误时不能这么强制类型转换,因为数组不是基本类型,基本数据类型转换才可以。对于数组的强制类型转换需要将数组中每一个数据取出来然后对其进行强制类型转换。
Bean property 'packagesToScan' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
关于这个问题我也是上网搜了一下,然后自己又看看了看错误的提示,发现这个'packagesToScan‘这个属性是在
org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean这个类里面,而不是我们以前所说的那个org.springframework.orm.hibernate3.LocalSessionFactoryBean所以大家在应用注解配置的时候千万要注意,还有这个注解中扫描包的这个属性是从2.5版本开始有的,所以要注意版本。