1. 程式人生 > >關於java.lang.NumberFormatException: For input string:${redis.maxIdle}的報錯

關於java.lang.NumberFormatException: For input string:${redis.maxIdle}的報錯

仔細分析後:

原來是在測試時,沒有匯入redis.properties檔案,value把 r e d i s . m

a x I d l e
: F o r
i n p u t s t r i n g : " {redis.maxIdle}解析為字串,所以會報: For input string: " {redis.maxIdle}"異常。實際在專案部署啟動tomcat後就不會報這樣的異常,因為不會獲取不到配置檔案。

更改方法:

在spring配置檔案目錄下apllicationContext-redis中新增

<context:property-placeholder location=“classpath*:properties/*.properties” />

作者:追夢的螞蟻。
來源:CSDN
原文:https://blog.csdn.net/m0_37768843/article/details/82910093
版權宣告:本文為博主原創文章,轉載請附上博文連結!