Spring开发踩坑记录
#1 @EnableEurekaServer无法正常import原因是spring-cloud-dependencies版本太低,改成高版本的Edgware.SR4即可。参考:https://www.cnblogs.com/zhuwenjoyce/p/9655940.html
<!-- 使用dependencyManagement进行版本管理 -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Edgware.SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
#2 报错! java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Object;) 参考:https://www.cnblogs.com/syp172654682/p/9015057.html
是由于spring boot版本兼容性导致的,在pom.xml中修改配置文件,修改前:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
修改后:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
#3 报错! Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 参考:https://blog.csdn.net/lance521/article/details/77847278 和 https://blog.csdn.net/xyjcfucdi128/article/details/86595936 解决:需要在启动类的@SpringBootApplication中添加exclude = {DataSourceAutoConfiguration.class}
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
#4 报错! Parameter 3 of method eurekaRegistration in org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration required a 参考:https://blog.csdn.net/u013276512/article/details/81088966
少了一个配置“'eureka.client.healthcheck.enabled'”,于是在项目的 application.yml文件中添加了eureka.client.healthcheck.enabled=true,如下:
eureka:
client:
healthcheck:
enabled: true
#5 报错! Dependency 'org.csource:fastdfs-client-java:1.27-SNAPSHOT' not found 参考:https://www.jianshu.com/p/c39ca1ee222b
从 https://github.com/happyfish100/fastdfs-client-java 下载
git clone https://github.com/happyfish100/fastdfs-client-java.git # 进入下载好的fastdfs-client-java 解压 $ cd /fastdfs-client-java # 使用maven打包jar $ mvn clean install
构建完成后会自动把fastdfs-client-java-1.27-SNAPSHOT.jar安装到本地的Maven仓库
[INFO] Installing E:\cf\git\fastdfs-client-java-master\target\fastdfs-client-jav a-1.27-SNAPSHOT.jar to D:\Development\MavenRepository\org\csource\fastdfs-client -java\1.27-SNAPSHOT\fastdfs-client-java-1.27-SNAPSHOT.jar [INFO] Installing E:\cf\git\fastdfs-client-java-master\pom.xml to D:\Development \MavenRepository\org\csource\fastdfs-client-java\1.27-SNAPSHOT\fastdfs-client-ja va-1.27-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 25.148 s [INFO] Finished at: --15T10::+: [INFO] ------------------------------------------------------------------------
#6 报错!@SpringBootApplication used in default package 参考:https://blog.csdn.net/weixin_42323802/article/details/84561492 和 https://blog.csdn.net/qq544649790/article/details/83032497 在@springbootApplication 注解失效的情况下,推荐使用@CompentScan 和@EnableAutoConfiguration进行代替
修改前:
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
@SpringBootApplication
修改后:
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
@ComponentScan("com.dataplatform")
//@SpringBootApplication
#7 java: 程序包org.csource.fastdfs不存在,事实上已经在本地编译安装了fastdfs-client-java 参考:http://www.mamicode.com/info-detail-2329592.html 和 https://stackoverflow.com/questions/8150535/intellij-idea-indexed-maven-repositories-list-how-to-add-remote-maven-repos 先自己编译源码成jar本地安装到maven的本地仓库,选中项目的主pom.xml文件,右键Maven -> Open 'settings.xml',更新其中的信息为本地的库
#8 IllegalArgumentException: java.net.UnknownHostException: quickstart.cloudera 参考:https://blog.csdn.net/ganeshys2017/article/details/81360921 和 https://www.cnblogs.com/chenligeng/p/9347149.html 在hosts文件中配置主机名quickstart.cloudera对应的IP地址
#9 报错!repackage failed: Unable to find a single main class from the following candidates 报错!idea maven 只编译 不运行
未能针对性解决,但是重启后问题消失了!
#10 报错!NoSuchMethodError: org.springframework.core.annotation.AnnotationUtils.clearCache()V 参考:https://blog.csdn.net/ghhgc/article/details/81213566 和 https://blog.csdn.net/qq_42664961/article/details/83860119 解决方法:将spring-cloud-starter-openfeign的版本修改为和spring-cloud一致,如下所示
修改前:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>2.0.0.RC1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
修改后:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Spring开发踩坑记录的更多相关文章
- uni-app开发踩坑记录
大部分问题是我在h5端看不到而在android.iOS平台上暴露出来的,不包含小程序 1.:class="['defaultStyle', dynamicStyle]" 不支持直接 ...
- [转]微信小程序开发踩坑记录
本文转自:http://www.cnblogs.com/NKnife/p/6283605.html 1.由于小程序wx.request()方法是异步的,在app.js执行ajax后,各分页加载app. ...
- 微信小程序开发踩坑记录
1.由于小程序wx.request()方法是异步的,在app.js执行ajax后,各分页加载app.js的全局数据时,无法按顺序加载.例: //app.js App({ ajax:function() ...
- uniapp开发踩坑记录
数组绑定class的问题 版本:v1.5.4 自定义了一个icon的组件,部分代码如下 <template> <text :class="[name, icon]" ...
- wepy开发踩坑记录
与vue的不同 methods对象只存放tap等事件触发时的方法 events对象只存放$emit及$broadcast方法触发的事件 自定义方法及属性放在与methods平级的位置 props是动态 ...
- spring boot +dubbo 踩坑记录
今天初次搭建spring boot +duboo的demo.记录一下踩坑记录. 首先搭建3个小demo,一个maven项目,两个spring boot (服务提供者和服务消费者)项目. 两 sprin ...
- 你真的了解字典(Dictionary)吗? C# Memory Cache 踩坑记录 .net 泛型 结构化CSS设计思维 WinForm POST上传与后台接收 高效实用的.NET开源项目 .net 笔试面试总结(3) .net 笔试面试总结(2) 依赖注入 C# RSA 加密 C#与Java AES 加密解密
你真的了解字典(Dictionary)吗? 从一道亲身经历的面试题说起 半年前,我参加我现在所在公司的面试,面试官给了一道题,说有一个Y形的链表,知道起始节点,找出交叉节点.为了便于描述,我把上面 ...
- SpringBoot+SpringSecurity+Thymeleaf认证失败返回错误信息踩坑记录
Spring boot +Spring Security + Thymeleaf认证失败返回错误信息踩坑记录 步入8102年,现在企业开发追求快速,Springboot以多种优秀特性引领潮流,在众多使 ...
- SpringBoot + Shiro + shiro.ini 的踩坑记录
0.写在前面的话 好久没写博客了,诶,好多时候偷懒直接就抓网上的资料丢笔记里了,也就没有自己提炼,偷懒偷懒.然后最近参加了一个网络课程,要交作业的那种,为了能方便看下其他同学的作业,就写了个爬虫把作业 ...
随机推荐
- C# 重载与重写
重载(overload) 指调用同一方法名,但各方法中参数的数据类型.个数或顺序不同. public static int Add(int x,int y) { return x + y; } pub ...
- Linux 服务器作为Nginx web服务器常见优化参数
内核参数调整cat /etc/sysctl.conf# sysctl settings are defined through files in # /usr/lib/sysctl.d/, /run/ ...
- python 在linux上面安装beautifulsoup4(bs4) No module named 'bs4'
续费了我的服务器 重做系统成了Linux服务器 然后想把Windown上的Python脚本放上去运行 但是出现了 No module named 'bs4' 的问题 pip install bs4 试 ...
- vue 每20秒刷新1次接口的实现方法
实现代码: setInterval(() => { setTimeout(fun, ) }, ) 备注: setInterval 放在内层 长时间会影响性能,造成页面卡顿甚至崩溃, 内层配合se ...
- js函数声明外面使用小括号括起来再接一个小括号的写法
js函数声明外面使用小括号括起来再接一个小括号的写法 (function(){})(); (function(){}()); !function(){}(); 总结ps:意思将函数声明变成,直接执行的 ...
- JS-条件语句5准则
准则: 1.多重判断时使用 Array.includes 2.更少的嵌套,尽早 return 3.使用默认参数和解构 4.倾向于遍历对象而不是 Switch 语句 5.对 所有/部分 判断使用 Arr ...
- abp方法权限
一.自定义一个权限实体,也可以直接用abp的PermissionNames类 二.重写PermissionChecker中的IsGrantedAsync方法 public override async ...
- (一)tensorflow-gpu2.0学习笔记之开篇(cpu和gpu计算速度比较)
摘要: 1.以动态图形式计算一个简单的加法 2.cpu和gpu计算力比较(包括如何指定cpu和gpu) 3.关于gpu版本的tensorflow安装问题,可以参考另一篇博文:https://www.c ...
- Bugku-CTF社工篇之信息查找
- Hibernate学习(五)
自关联测试案例 1.创建表 drop table if exists t_category ; create table t_category ( id ) primary key , name ) ...