8
我嘗試實現加載照片和String對象。這是我的方法的聲明。無法處理部件,因爲即使現有的multipartResolver已經提供了多部分配置
@RequestMapping(method = RequestMethod.PUT, consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public @ResponseBody ResponseEntity<UserWithPhoto> update(@RequestHeader(value="Access-key") String accessKey,
@RequestHeader(value="Secret-key") String secretKey,
@RequestPart("user") String string,
@RequestPart("photo") MultipartFile file) throws Exception
這是我的多部分解析器
<beans:bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<beans:property name="maxUploadSize" value="10000000" />
</beans:bean>
而且我沒有帶想法,爲什麼我得到
java.lang.IllegalStateException: Unable to process parts as no multi-part configuration has been provided
成爲一個答案,這至少錯過了一些行:) – planetmaker