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.springframewor[email protected]2adb1d4]to prepare test instance [[email protected]]

java.lang.IllegalStateException : Failed to load ApplicationContext

這個錯誤找了半天,還以爲是邏輯錯誤,沒想是applicationContext.xml中的jdbcUrl要與上面的數據池dataSource.class中定義的相應的數據鏈接名稱一一對應。下面是自己配好的正確答案,根據自己參數的配。