java - spring 配置的 application-context.xml 文件中的错误
问题描述
application-context.xml
spring 框架的文件错误。它给出了参考文件的编译时错误
引用的文件包含错误(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>
请建议。
解决方案
推荐阅读
- javascript - 我的开关灯泡功能不起作用
- python - 如何在 Python 中测量包含延迟的子进程的时间?
- ruby-on-rails - 如何在 Rails 6 中使用rescue_from?
- spring - ClassCastException - 带有用户的 Spring Security
- vb.net - 多次快速单击时复选框无法正常工作
- microsoft-graph-api - 状态 403 禁止错误:Microsoft 图形 API https://graph.microsoft.com/v1.0/me/onlineMeetings
- java - Java - 最后创建的对象覆盖前一个
- c - 使用 mmap 时将整数存储为不正确的值
- c# - 文本框验证:控制/复制系统验证边框?
- r - 尝试在 R 中聚合数据