spring配置的application-context.xml文件中的错误

时间:2018-05-22 08:19:51

标签: java xml spring

spring框架的application-context.xml文件出错。它给出了参考文件的编译时错误

  

引用文件包含错误   (http://www.springframework.org/schema/beans/spring-beans.xsd)。对于   更多信息,右键单击问题视图中的消息   并选择"显示详细信息..."



<?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:mvc="http://www.springframework.org/schema/mvc"
	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/jee
 				   http://www.springframework.org/schema/jee/spring-jee.xsd
                   http://www.springframework.org/schema/context
                   http://www.springframework.org/schema/context/spring-context.xsd">

   
   <!-- Specifying base package of the Components like Controller, Service,
        DAO -->
    <context:component-scan base-package="com.common" />
    
    <!-- Getting Database properties -->
   <context:property-placeholder location="classpath:application.properties" />
   
   <mvc:annotation-driven />
    <!-- View Resolver -->
    <bean
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/" />
        <property name="suffix" value=".jsp" />
    </bean>
 
    <!-- step 1 : DataSource database / Datasource connection pool-->
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="${database.driver}"></property>
        <property name="url" value="${database.url}"></property>
        <property name="username" value="${database.user}"></property>
        <property name="password" value="${database.password}"></property>
    </bean>
    
    <!--step 2 : Hibernate SessionFactory -->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
        <property name="dataSource" ref="dataSource"></property>
        <property name="packagesToScan" value="com.common.objects"></property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
                <prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
            </props>
        </property>
    </bean>
   
    <!--step 3 : setting Hibernate Transaction manager-->
    <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    
    <bean id = "helloWorld" class = "com.tutorialspoint.HelloWorld">
      <property name = "message" value = "Hello World!"/>
    </bean>
</beans>
&#13;
&#13;
&#13;

请建议。

0 个答案:

没有答案