为什么80%的码农都做不了架构师?>>>
导致这个问题的原因有很多,基于我查到的资料做个记录
第一:xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"缺少的话可能会导致
<context:property-placeholder location="classpath:jdbc.properties"/>报错
第二:jar包的缺失或者版本不对也会导致${jdbc.url}被当成字符串处理或者<context:property-placeholder location="classpath:jdbc.properties"/>报错
第三:确保项目中只有一个<context:property-placeholder/>标签,如果有多个的话就是谁先加载谁就有用
第四:确保<context:property-placeholder location="classpath:jdbc.properties"/>是在${jdbc.url}之前加载。
我是在web.xml中配置加载spring容器的时候导致<context:property-placeholder location="classpath:zjdbc.properties"/>在${jdbc.url}之后加载。努力百度半天结果发现是这个问题,就把其他结果记录一下以防以后再用到