Spring-Cloud编译出错汇总

来源:互联网 发布:四分位数java 编辑:程序博客网 时间:2024/05/21 08:41

问题1:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:

No unique bean of type [com.mkyong.common.Person] is defined:

expected single matching bean but found 2: [personA, personB]


解决办法: @Qualifier()配合@Service()使用。

如:

在service实现类中:

@Service("ons")
public class VideointercomappService implements IVideointercomappService{}

在controller中引用:

@Autowired
  @Qualifier("ons")
  IVideointercomClients iVideointercomClients;


问题2:

The field file exceeds its maximum permitted size of 1048576 bytes.] with root cause

解决:

SpringBoot做文件上传时出现了The field file exceeds its maximum permitted size of 1048576 bytes.错误,显示文件的大小超出了允许的范围,原来Spring Boot工程嵌入的tomcat限制了请求的文件大小,这一点在Spring Boot的官方文档中有说明。


在application.yml

spring:
  http:
    multipart:
      max-file-size: 20Mb
      max-request-size: 20Mb


原创粉丝点击