2017-06-14 15 views
4

Spring-config xmlを作成すると、dataSourceを追加するとエラーが発生し、Beanを解決できないというメッセージが表示されます。 Bean driverClassNameを解決できません

enter image description here

マイ spring.xmlです:

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:context="http://www.springframework.org/schema/context" 
     xsi:schemaLocation=" 
     http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans.xsd 
     http://www.springframework.org/schema/context 
     http://www.springframework.org/schema/context/spring-context.xsd"> 

    <context:component-scan base-package="com.dqbz" /> 

    <!-- 配置整合mybatis过程 --> 
    <!-- 1.配置数据库相关参数properties的属性:${url} --> 
    <context:property-placeholder location="classpath:jdbc.properties" /> 

    <!-- 2.数据库连接池 --> 
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
     <!-- 基本属性driverClassName、 url、user、password --> 
     <property name="driverClassName" value="${jdbc.driver}" /> 
     <property name="url" value="${jdbc.url}" /> 
     <property name="username" value="${jdbc.username}" /> 
     <property name="password" value="${jdbc.password}" /> 
    </bean> 


</beans> 

答えて

-2

あなたはBean定義内から以下のコメントを削除しようとしたことがありますか?

<!-- 基本属性driverClassName、 url、user、password --> 
+0

これはコメントなので、質問には答えません。 –

+0

あなたは結論にすぐに飛び乗ることができてうれしいです。@ YassinHajaj設定を見ると、他には何の問題も見当たりません。ポストのタイトルに基づいて、「driverClassName」という名前のBeanについて不平を言っています。コメントには中国語の文字もあります。それがどのように解析されているかは誰が知っていますか。 – neal

+0

XMLは、文書の残りの部分が意味的に正しい限り、コメントをどこに貼り付けるかについて本当に気にしません。 – Makoto

関連する問題