报错:Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'driverClassName' of bean class [com.mchange.v2.c3p0.ComboPooledDataSource]: Bean property 'driverClassName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
页面代码: private static PersonDAO psd;
private static ApplicationContext cxt;
@BeforeClass
public static void setUpBeforeClass() throws Exception {
try {
cxt = new ClassPathXmlApplicationContext("beans.xml");
psd =(PersonDAO)cxt.getBean("serivceBean");
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testSave() {
psd.save(new Person("xxx"));
}
业务bean:
@Resource private SessionFactory sessionFactoy;
public void save(Person person) {
sessionFactoy.getCurrentSession().persist(person);
}
实体类:
private Integer id;
private String username;
public Person(){}
public Person(String username) {
this.username = username;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
beans.xml:
destroy-method="close">
.....