Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]:

1.  警告: Exception encountered during contextinitialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name'dataSource' defined in class path resource [applicationContext.xml]: Errorsetting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'jdbcUrl' of beanclass [com.alibaba.druid.pool.DruidDataSource]: Bean property 'jdbcUrl' is notwritable or has an invalid setter method. Does the parameter type of the settermatch the return type of the getter?

2.  严重: Caught exception while allowingTestExecutionListener[org.springframework.test.contex[email protected]]to prepare test instance [[email protected]]

java.lang.IllegalStateException: Failed to load ApplicationContext

这个错误找了半天,还以为是逻辑错误,没想是applicationContext.xml中的jdbcUrl要与上面的数据池dataSource.class中定义的相应的数据链接名称一一对应。下面是自己配好的正确答案,根据自己参数的配。

Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: