映射器是同时处理多个文件还是映射器一次只能处理一个文件?我想知道默认行为
我在我的 mvc-dispatcher-servlet.xml 中使用 spring 配置文件。但得到错误:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'bean'. One of '{"http://www.springframework.org/schema/beans":beans}' is expected.
Run Code Online (Sandbox Code Playgroud)
我没有在配置文件中添加其他 bean,因为我希望它们在两个配置文件中使用。需要帮助解决错误。下面是我的 XML,错误出现在 line bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager"> :
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
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/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.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.mycompany.saas.*" />
<!-- Getting Database properties -->
<context:property-placeholder location="classpath:db.properties" />
<!-- Getting Configuration properties -->
<!-- <context:property-placeholder location="classpath:config.properties"
/> -->
<mvc:annotation-driven />
<beans profile="default">
<!-- DataSource …Run Code Online (Sandbox Code Playgroud)