gpt4 book ai didi

spring-mvc - 如何配置 MultipartResolver?

转载 作者:行者123 更新时间:2023-12-04 02:26:56 24 4
gpt4 key购买 nike

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

<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven />

<!-- Handles HTTP GET requests for /resources/** by efficiently serving
up static resources in the ${webappRoot}/resources/ directory -->
<resources mapping="/resources/**" location="/resources/" />
<bean class="org.springframework.web.multipart.commons.CommonsMultipartResolver"
id="multipartResolver"> <property name="maxUploadSize" value="500000" />
</bean>

有我的 context.xml 文件,但是当我包含 multipartResolver 配置时,出现以下错误:

"cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'bean'.".

请帮助我,我是 Spring 的新手。

最佳答案

我认为你应该在 beanproperty 前加上 beans:

...
<beans:bean class="org.springframework.web.multipart.commons.CommonsMultipartResolver" id="multipartResolver">
<beans:property name="maxUploadSize" value="500000" />
</beans:bean>
...

并记住用结束标记结束 XML:

...
</beans:beans>

关于spring-mvc - 如何配置 MultipartResolver?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11499051/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com