Heim > Fragen und Antworten > Hauptteil
容器启动的时候出错
配置文件如下:
报错信息如下:
1 2 3 4 |
|
怎么解决呢?
PHP中文网2017-04-17 17:45:48
1.这个首先确保下,你的properties位置没有错,如果你是跑单测时候,最好确保在test的路径下也有。
2.如果确认配置文件是OK的,spring会有一个工具类NumberUtils
来处理。
1 2 3 4 5 6 7 8 |
|
会把string转换成Intger类型,如果还是不行的话,可以试试用SPEL
语句,来强制转换
1 |
|
PHPz2017-04-17 17:45:48
Failed to convert value of type 'java.lang.String' to required type 'int'; nested exception is java.lang.NumberFormatException: For input string: "${maxPic}"
这个报错这么明显。。。init bean的时候spring自动转换赋值macPic参数,但是String 转int 异常了
ringa_lee2017-04-17 17:45:48
exception is java.lang.NumberFormatException: For input string: "${maxPic}",你是不是写的maxPic加了引号报错了