最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

升級(jí)springboot3.x踩坑記錄

 更新時(shí)間:2024年05月08日 11:41:03   作者:奔跑的羊駝  
本文主要介紹了升級(jí)springboot3.x踩坑記錄,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

0x01 redis連接異常

先貼一張項(xiàng)目啟動(dòng)的堆棧信息

2023-02-06 11:20:14:162 WARN   [boundedElastic-1] o.s.b.a.d.r.RedisReactiveHealthIndicator -Redis health check failed
org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.translateException(LettuceConnectionFactory.java:1602)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1533)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1358)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1341)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedReactiveConnection(LettuceConnectionFactory.java:1083)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getReactiveConnection(LettuceConnectionFactory.java:479)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getReactiveConnection(LettuceConnectionFactory.java:105)
	at reactor.core.publisher.MonoSupplier.call(MonoSupplier.java:67)
	at reactor.core.publisher.FluxSubscribeOnCallable$CallableSubscribeOnSubscription.run(FluxSubscribeOnCallable.java:227)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.springframework.data.redis.connection.PoolException: Could not get a resource from the pool
	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:105)
	at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1531)
	... 14 common frames omitted
Caused by: io.lettuce.core.RedisConnectionException: Unable to connect to localhost/<unresolved>:6379
	at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:78)
	at io.lettuce.core.RedisConnectionException.create(RedisConnectionException.java:56)
	at io.lettuce.core.AbstractRedisClient.getConnection(AbstractRedisClient.java:350)
	at io.lettuce.core.RedisClient.connect(RedisClient.java:216)
	at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:111)
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:111)
	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.lambda$getConnection$0(LettucePoolingConnectionProvider.java:93)
	at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:211)
	at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:201)
	at org.apache.commons.pool2.BasePooledObjectFactory.makeObject(BasePooledObjectFactory.java:70)
	at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:571)
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:298)
	at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:223)
	at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:122)
	at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:117)
	at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:99)
	... 15 common frames omitted
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: no further information: localhost/127.0.0.1:6379
Caused by: java.net.ConnectException: Connection refused: no further information
	at java.base/sun.nio.ch.Net.pollConnect(Native Method)
	at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
	at java.base/sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:946)
	at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:337)
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)

在升級(jí)springboot3.x后啟動(dòng)項(xiàng)目發(fā)現(xiàn)redis連接報(bào)錯(cuò)了,根據(jù)堆棧異常信息發(fā)現(xiàn)redis竟然去鏈接了本地服務(wù),該項(xiàng)目使用了Nacos配置也都在上,突然的異常感覺挺奇怪的,本來以為是升級(jí)后無法拉取到Nacos的配置信息了后經(jīng)驗(yàn)證使用@Value注解或者其他配置類均未發(fā)生該問題,那就只能懷疑是spring對(duì)redis的配置支持改變了,所以直接點(diǎn)就去找了redis的自動(dòng)配置類發(fā)現(xiàn)確實(shí)改變了配置前綴為spring.data.redis(原該項(xiàng)目springboot版本為2.7.4時(shí)redis配置前綴為spring.redis)貼一下版本屬性內(nèi)容對(duì)比圖

3.x版本時(shí):

@ConfigurationProperties(prefix = "spring.data.redis")
public class RedisProperties {

	/**
	 * Database index used by the connection factory.
	 */
	private int database = 0;

	/**
	 * Connection URL. Overrides host, port, and password. User is ignored. Example:
	 * redis://user:password@example.com:6379
	 */
	private String url;

	/**
	 * Redis server host.
	 */
	private String host = "localhost";

	/**
	 * Login username of the redis server.
	 */
	private String username;

	/**
	 * Login password of the redis server.
	 */
	private String password;

	/**
	 * Redis server port.
	 */
	private int port = 6379;

	/**
	 * Whether to enable SSL support.
	 */
	private boolean ssl;

	/**
	 * Read timeout.
	 */
	private Duration timeout;

	/**
	 * Connection timeout.
	 */
	private Duration connectTimeout;

	/**
	 * Client name to be set on connections with CLIENT SETNAME.
	 */
	private String clientName;

	/**
	 * Type of client to use. By default, auto-detected according to the classpath.
	 */
	private ClientType clientType;

	private Sentinel sentinel;

	private Cluster cluster;

	private final Jedis jedis = new Jedis();

	private final Lettuce lettuce = new Lettuce();

}

2.7.4版本時(shí):

@ConfigurationProperties(prefix = "spring.redis")
public class RedisProperties {

	/**
	 * Database index used by the connection factory.
	 */
	private int database = 0;

	/**
	 * Connection URL. Overrides host, port, and password. User is ignored. Example:
	 * redis://user:password@example.com:6379
	 */
	private String url;

	/**
	 * Redis server host.
	 */
	private String host = "localhost";

	/**
	 * Login username of the redis server.
	 */
	private String username;

	/**
	 * Login password of the redis server.
	 */
	private String password;

	/**
	 * Redis server port.
	 */
	private int port = 6379;

	/**
	 * Whether to enable SSL support.
	 */
	private boolean ssl;

	/**
	 * Read timeout.
	 */
	private Duration timeout;

	/**
	 * Connection timeout.
	 */
	private Duration connectTimeout;

	/**
	 * Client name to be set on connections with CLIENT SETNAME.
	 */
	private String clientName;

	/**
	 * Type of client to use. By default, auto-detected according to the classpath.
	 */
	private ClientType clientType;

	private Sentinel sentinel;

	private Cluster cluster;

	private final Jedis jedis = new Jedis();

	private final Lettuce lettuce = new Lettuce();

}

至此問題解決。

到此這篇關(guān)于升級(jí)springboot3.x踩坑記錄的文章就介紹到這了,更多相關(guān)升級(jí)springboot3.x 內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Java BufferedWriter BufferedReader 源碼分析

    Java BufferedWriter BufferedReader 源碼分析

    本文是關(guān)于Java BufferedWriter ,BufferedReader 簡(jiǎn)介、分析源碼 對(duì)Java IO 流深入了解,希望看到的同學(xué)對(duì)你有所幫助
    2016-07-07
  • Lucene?索引刪除策略源碼解析

    Lucene?索引刪除策略源碼解析

    這篇文章主要為大家介紹了Lucene?索引刪除策略源碼解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-03-03
  • Java如何通過屬性名獲取Object對(duì)象屬性值

    Java如何通過屬性名獲取Object對(duì)象屬性值

    這篇文章主要介紹了Java如何通過屬性名獲取Object對(duì)象屬性值問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-07-07
  • Spring Boot Event Bus用法小結(jié)

    Spring Boot Event Bus用法小結(jié)

    Spring Boot Event Bus是Spring框架中事件驅(qū)動(dòng)編程的一部分,本文主要介紹了Spring Boot Event Bus用法小結(jié),感興趣的可以了解一下
    2023-09-09
  • java愛心代碼完整示例(脫單必備)

    java愛心代碼完整示例(脫單必備)

    最近看到個(gè)好玩的,就是用代碼實(shí)現(xiàn)愛心的形狀,對(duì)于不懂編程的人來說,這是一個(gè)很好的玩的東西,這篇文章主要給大家介紹了關(guān)于java愛心代碼的相關(guān)資料,需要的朋友可以參考下
    2023-07-07
  • 基于springboot activiti 配置項(xiàng)解析

    基于springboot activiti 配置項(xiàng)解析

    這篇文章主要介紹了springboot activiti 配置項(xiàng)解析,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-09-09
  • Java實(shí)戰(zhàn)之實(shí)現(xiàn)一個(gè)好用的MybatisPlus代碼生成器

    Java實(shí)戰(zhàn)之實(shí)現(xiàn)一個(gè)好用的MybatisPlus代碼生成器

    這篇文章主要介紹了Java實(shí)戰(zhàn)之實(shí)現(xiàn)一個(gè)好用的MybatisPlus代碼生成器,文中有非常詳細(xì)的代碼示例,對(duì)正在學(xué)習(xí)java的小伙伴們有非常好的幫助,需要的朋友可以參考下
    2021-04-04
  • 詳解Spring-Boot中如何使用多線程處理任務(wù)

    詳解Spring-Boot中如何使用多線程處理任務(wù)

    本篇文章主要介紹了詳解Spring-Boot中如何使用多線程處理任務(wù),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下。
    2017-03-03
  • Java 8 對(duì) HashSet 元素進(jìn)行排序的操作方法

    Java 8 對(duì) HashSet 元素進(jìn)行排序的操作方法

    Java 中HashSet是一個(gè)不保證元素順序的集合類,其內(nèi)部是基于 HashMap 實(shí)現(xiàn)的,HashSet不支持排序,我們?cè)谛枰獙?duì)HashSet 排序時(shí),必須將其轉(zhuǎn)換為支持排序的集合或數(shù)據(jù)結(jié)構(gòu),如 List,本文將詳細(xì)介紹在 Java 8 中如何對(duì) HashSet 中的元素進(jìn)行排序,感興趣的朋友一起看看吧
    2024-11-11
  • Java棋類游戲?qū)嵺`之單機(jī)版五子棋

    Java棋類游戲?qū)嵺`之單機(jī)版五子棋

    這篇文章主要為大家詳細(xì)介紹了Java棋類游戲中的五子棋實(shí)現(xiàn)方法,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-02-02

最新評(píng)論

永泰县| 四会市| 乌拉特前旗| 蒙自县| 石河子市| 和林格尔县| 平潭县| 洮南市| 定结县| 广东省| 沙湾县| 大余县| 莎车县| 赤壁市| 红河县| 兴业县| 文安县| 清徐县| 敦化市| 电白县| 台山市| 钟祥市| 乐业县| 南汇区| 宝坻区| 武安市| 卢龙县| 谢通门县| 阿拉善盟| 贡山| 丽江市| 石狮市| 吴桥县| 宣威市| 秭归县| 克山县| 榕江县| 德兴市| 胶南市| 宝鸡市| 赞皇县|