導致的 Access denied for user ''@'localhost' to database 問題

解決辦法:
1、改用以下配置:

 <bean id= "propertyConfigurer"
               class= "org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" >
              <property name= "locations">
                     <list>
                           <value> classpath:jdbc.properties</value >
                     </list>
              </property>
        </bean>

2、properties文件中的key不要與系統配置重名,比如 jdbcusername=root ,username=root
3、將context:property-placeholder 中屬性system-properties-mode 默認值配置成:NEVER

原因

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章