我是靠谱客的博主 腼腆黑猫,这篇文章主要介绍ClassNotFoundException: com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect的处理,现在分享给大家,希望可以做个参考。

今天在学习springcloud的时候遇到了一个问题,

复制代码
1
2
ClassNotFoundException: com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect

项目结构如下

复制代码
1
2
3
4
5
springcloud4 --eureka-server --order-server --product-server

顶层的pom有

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-eureka</artifactId> <version>1.4.2.RELEASE</version> </dependency> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Greenwich.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement>

我在启动order-server的时候就报了这个异常,其中order-server的启动类代码为

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@SpringCloudApplication @EnableFeignClients @EntityScan("cn.itcast.order.entity") public class OrderApplication { public static void main(String[] args) { SpringApplication.run(OrderApplication.class, args); System.out.println("***************************************************"); System.out.println(OrderApplication.class.getSimpleName() + "启动成功"); System.out.println("***************************************************"); } }

后面我添加了个依赖

复制代码
1
2
3
4
5
6
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-hystrix</artifactId> <version>1.4.2.RELEASE</version> </dependency>

就可以启动了。
推测是@SpringCloudApplication囊括了很多的springcloud组件在内,但是并没有吧相应的依赖弄进来

最后

以上就是腼腆黑猫最近收集整理的关于ClassNotFoundException: com.netflix.hystrix.contrib.javanica.aop.aspectj.HystrixCommandAspect的处理的全部内容,更多相关ClassNotFoundException:内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(66)

评论列表共有 0 条评论

立即
投稿
返回
顶部