会员可以在此提问,尚新途老师有问必答

对大家有帮助的问答会被标记为“推荐”,看完课程过来浏览一下别人提的问题,会帮你学得更全面

截止目前,同学们一共提了129445个问题
真好2024-05-08 17:39:29

关于maven项目中

<dependencyManagement>

标签使用的问题



问题描述:

对于pom.xml中<dependencyManagement>使用,我的理解是,子项目需要与父项目中groupIdartifactId对应,才能匹配上版本号。

但是这种情况,子项目只有groupId与父<dependencyManagement>中的groupId匹配上了,artifactId没有匹配上,但却仍然匹配上了了版本号,这是为什么?

具体例子:


父项目:

<dependencyManagement>
 <dependencies>
   <dependency>
     <groupId>org.springframework.cloud</groupId>
     <artifactId>spring-cloud-dependencies</artifactId>
     <version>Greenwich.SR5</version>
     <type>pom</type>
     <scope>import</scope>
   </dependency>
 </dependencies>
</dependencyManagement>



子项目:

<dependencies>
 <dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
 </dependency>
 <dependency>
   <groupId>org.springframework.cloud</groupId>
   <artifactId>spring-cloud-starter-netflix-zuul</artifactId>
 </dependency>
</dependencies>



我的理解是:子项目根据<groupId>org.springframework.cloud</groupId>与父项目<dependencyManagement>中groupId匹配上了,由于父项目中<artifactId>spring-cloud-dependencies</artifactId>里面含有   <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>和

   <artifactId>spring-cloud-starter-netflix-zuul</artifactId>,所以也能匹配上,匹配的版本号就是与父项目<artifactId>spring-cloud-dependencies</artifactId>中对应的

<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>和

   <artifactId>spring-cloud-starter-netflix-zuul</artifactId>,版本号



请老师帮忙解答下?

相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
Try丨harder2024-01-07 15:56:54

image.png

老师,这里报空指针是为啥呢?

相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
微信用户2023-12-30 20:10:34

老师,我在进行高可用部署的时候,可以正常运行,并且其他服务也可以正常运行,但是eureka的服务端会爆如下错误(请您有时间的话可以解答一下):

2023-12-30T20:06:53.437+08:00 ERROR 46409 --- [et_localhost-18] c.n.e.cluster.ReplicationTaskProcessor   : Network level connection to peer localhost; retrying after delay


jakarta.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused

at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:531) ~[jersey-apache-connector-3.1.2.jar:na]

at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:300) ~[jersey-client-3.1.2.jar:na]

at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$0(JerseyInvocation.java:662) ~[jersey-client-3.1.2.jar:na]

at org.glassfish.jersey.client.JerseyInvocation.call(JerseyInvocation.java:697) ~[jersey-client-3.1.2.jar:na]

at org.glassfish.jersey.client.JerseyInvocation.lambda$runInScope$3(JerseyInvocation.java:691) ~[jersey-client-3.1.2.jar:na]

at org.glassfish.jersey.internal.Errors.process(Errors.java:292) ~[jersey-common-3.1.2.jar:na]

at org.glassfish.jersey.internal.Errors.process(Errors.java:274) ~[jersey-common-3.1.2.jar:na]

at org.glassfish.jersey.internal.Errors.process(Errors.java:205) ~[jersey-common-3.1.2.jar:na]

at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390) ~[jersey-common-3.1.2.jar:na]

at org.glassfish.jersey.client.JerseyInvocation.runInScope(JerseyInvocation.java:691) ~[jersey-client-3.1.2.jar:na]

at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:661) ~[jersey-client-3.1.2.jar:na]

at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:439) ~[jersey-client-3.1.2.jar:na]

at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:345) ~[jersey-client-3.1.2.jar:na]

at com.netflix.eureka.transport.Jersey3ReplicationClient.submitBatchUpdates(Jersey3ReplicationClient.java:116) ~[eureka-core-jersey3-2.0.1.jar:2.0.1]

at com.netflix.eureka.cluster.ReplicationTaskProcessor.process(ReplicationTaskProcessor.java:80) ~[eureka-core-2.0.1.jar:2.0.1]

at com.netflix.eureka.util.batcher.TaskExecutors$BatchWorkerRunnable.run(TaskExecutors.java:190) ~[eureka-core-2.0.1.jar:2.0.1]

at java.base/java.lang.Thread.run(Thread.java:842) ~[na:na]

Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused

at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156) ~[httpclient-4.5.14.jar:4.5.14]

at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376) ~[httpclient-4.5.14.jar:4.5.14]

at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393) ~[httpclient-4.5.14.jar:4.5.14]

at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) ~[httpclient-4.5.14.jar:4.5.14]

at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) ~[httpclient-4.5.14.jar:4.5.14]

at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[httpclient-4.5.14.jar:4.5.14]

at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[httpclient-4.5.14.jar:4.5.14]

at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[httpclient-4.5.14.jar:4.5.14]

at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72) ~[httpclient-4.5.14.jar:4.5.14]

at org.glassfish.jersey.apache.connector.ApacheConnector.apply(ApacheConnector.java:483) ~[jersey-apache-connector-3.1.2.jar:na]

... 16 common frames omitted

Caused by: java.net.ConnectException: Connection refused

at java.base/sun.nio.ch.Net.pollConnect(Native Method) ~[na:na]

at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672) ~[na:na]

at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:554) ~[na:na]

at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:602) ~[na:na]

at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[na:na]

at java.base/java.net.Socket.connect(Socket.java:633) ~[na:na]

at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:75) ~[httpclient-4.5.14.jar:4.5.14]

at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) ~[httpclient-4.5.14.jar:4.5.14]

... 25 common frames omitted


相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
李博2023-11-19 14:15:50

有没有需要注意的点,我启动成功了,容器也存在,端口也开着,防火墙业关了,但还是访问不到,其他服务比如prometheus可以访问到

相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
李博2023-11-17 17:57:30

服务也启动了,可以访问到8068页面,但页面是空白的,这是哪出问题了

相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
1dx2023-11-14 04:09:48

哪些配置可以放在远程配置中心哪些配置放在本地bootstrap?或者说本地最小配置是什么?

相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
Rally_YJ2023-10-08 11:03:59

老师这个怎么来的image.png

相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
Rally_YJ2023-10-08 10:21:16

老师键盘按什么键可以选择try catch语句呢

相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
云舒2023-09-03 21:47:54
相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
喜欢雨天。2023-08-09 20:57:27

提问:为什么在服务提供者需要引入Web这个依赖?(已经尝试过若不引入,运行会报错)


相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
花生°2023-07-26 10:58:25
这里得TimeUnit.SECONDS.sleep(5)可以换成Thread.sleep(5000);吗
相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
接班人nei2023-07-08 12:42:29

image.png


老师 消息是怎么被业务层方法区分类型的呢 上面只是定义的业务层方法名字  那他咋知道具体是哪种消息的呢

相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud
PvemiP92023-05-27 20:57:21

老师,我可以问一下我们这个之中的message是怎么获得的嘛


相关课程:JAVA 全系列/第十九阶段:Spring Cloud微服务技术栈/Spring Cloud

©2014-2023 百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备13018289号-12    营业执照    经营许可证:京B2-20212637