1、
This application has no explicit mapping for /error, so you are seeing this as a fallback.There was an unexpected error (type=Not Found, status=404).
如果出现此错误,查看是否需要@ResponseBody注解
原因:不加@ResponseBody代表返回一个视图,加上注解的话代表返回数据,如果返回数据时不加,也会出现404
2、[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.7.RELEASE:repackage (repackage) on project shopping-mall-spi: Execution repackage of goal org.springframework.boot:spring-boot-maven-plugin:2.1.7.RELEASE:repackage failed: Unable to find main class -> [Help 1]
我在打包spi(spi为我的接口包)时,报这个错,原因是因为此包只是一个接口包,不应该加入spring-boot-maven-plugin打包插件,在pom文件中去掉即可
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
具体报错的图片
3、nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'productName' in 'class java.lang.String'] with root cause
org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'productName' in 'class java.lang.String'
整合mybatis时,dao层中的文件要添加@Param注解,否则就会报这个错
List<ProductPO> searchProduct(@Param("productName") String productName);
4、org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration': Unsatisfied dependency expressed through field 'eurekaServerBootstrap'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eurekaServerBootstrap' defined in class path resource
如果是用的2.0版本以上的springboot时,使用eureka时,除了导入eureka的包以外,还需要导入hystrix的包
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-netflix-eureka-server</artifactId> <version>2.0.0.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> <version>2.0.0.RELEASE</version> </dependency>
或者直接导入eureka和hystrix合体的包
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> <version>2.0.0.RELEASE</version> </dependency>
5、ERROR org.springframework.boot.SpringApplication - Application run failed
java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;)V
at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContextspringboot使用的是2.0以上的版本,rureka客户端引用eureka-client的包的版本太低,换成2.0.0-RELEASE版本
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> <version>2.0.0.RELEASE</version> </dependency>
6、Failed to collect dependencies at org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.21.RELEASE:
错误:版本使用不对,注意springboot和springboot-starter-data-jpa的版本需要进行搭配一致;