您的位置:首页 > 编程语言 > Java开发

Spring-Cloud编译出错汇总

2017-12-15 23:45 351 查看
问题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

问题3:

端口被暂用,无法启动工程

解决:

1、命令行模式查找到占用端口的进程号PID是多少,如:8080

netstat -ano | findstr 8080

这个命令输出的最后一列表示占用8080端口的进程号是多少,假设为1234

2、kill掉这个进程即可

taskkill /F /PID 1234

问题4.

当需要看js中返回json对象内容时:

JSON.parse(jsonstr); //可以将json字符串转换成json对象

JSON.stringify(jsonobj); //可以将json对象转换成json对符串 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: