将相本无种,男儿当自强。这篇文章主要讲述java.lang.IllegalStateException: Failed to load ApplicationContext相关的知识,希望能为你提供帮助。
错误提示:
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource‘ defined in class path resource [applicationContext.xml]: Error setting property values;
nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property ‘jdbcUrl‘ of bean class [org.springframework.jdbc.datasource.DriverManagerDataSource]: Bean property ‘jdbcUrl‘ is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property ‘jdbcUrl‘ of bean class [org.springframework.jdbc.datasource.DriverManagerDataSource]: Bean property ‘jdbcUrl‘ is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Spring内置数据源配置:
<
!-- 引入外部属性配置文件-->
<
context:property-placeholder location="classpath:db.properties"/>
<
!-- 配置内置的数据源bean,使用db.properties -->
<
bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<
property name="driverClassName" value="https://www.songbingjia.com/android/${jdbc.driverClass}"/>
<
property name="url" value="https://www.songbingjia.com/android/${jdbc.url}"/>
<
property name="username" value="https://www.songbingjia.com/android/${jdbc.username}"/>
<
property name="password" value="https://www.songbingjia.com/android/${jdbc.password}"/>
<
/bean>
c3p0连接池配置:
<
!-- c3p0数据源,使用db.properties -->
<
bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<
property name="driverClass" value="https://www.songbingjia.com/android/${jdbc.driverClass}"/>
<
property name="jdbcUrl" value="https://www.songbingjia.com/android/${jdbc.url}"/>
<
property name="user" value="https://www.songbingjia.com/android/${jdbc.username}"/>
<
property name="password" value="https://www.songbingjia.com/android/${jdbc.password}"/>
<
/bean>
【java.lang.IllegalStateException: Failed to load ApplicationContext】错误原因:注意property中name属性命名.
推荐阅读
- C# Xamarin For Android自动升级项目实战
- android studio listview长按删除
- 微信小程序之(获得appid)
- APP性能(Android手机)(内存和CPU)
- app自动化测试之实战应用(百度app简单测试)
- Appium关键字
- Cocoapods报错xcrun: error: active developer path ("/Users/wangwei/Downloads/Xcode.app/Contents/De
- 初次使用Androidstudio
- 笔记本玩游戏不能全屏,本文教您如何设置笔记本