java:無(wú)法訪問(wèn)org.springframework.boot.SpringApplication的解決方法
報(bào)錯(cuò)信息如下:
java: 無(wú)法訪問(wèn)org.springframework.boot.SpringApplication
錯(cuò)誤的類文件: /C:/Users/11848/.m2/repository/org/springframework/boot/spring-boot/3.0.0/spring-boot-3.0.0.jar!/org/springframework/boot/SpringApplication.class
類文件具有錯(cuò)誤的版本 61.0, 應(yīng)為 52.0
請(qǐng)刪除該文件或確保該文件位于正確的類路徑子目錄中。
解決辦法:
這個(gè)錯(cuò)誤的原因是idea默認(rèn)的spring-boot-starter-parent
版本是3.0
,改成2.7.6
或者更低版本就可以了
合并集合
一共有 n 個(gè)數(shù),編號(hào)是 1∼n,最開(kāi)始每個(gè)數(shù)各自在一個(gè)集合中。
現(xiàn)在要進(jìn)行 m 個(gè)操作,操作共有兩種:
M a b,將編號(hào)為 a 和 b 的兩個(gè)數(shù)所在的集合合并,如果兩個(gè)數(shù)已經(jīng)在同一個(gè)集合中,則忽略這個(gè)操作;
Q a b,詢問(wèn)編號(hào)為 a 和 b 的兩個(gè)數(shù)是否在同一個(gè)集合中;
輸入格式
第一行輸入整數(shù) n 和 m。
接下來(lái) m 行,每行包含一個(gè)操作指令,指令為 M a b 或 Q a b 中的一種。
輸出格式
對(duì)于每個(gè)詢問(wèn)指令 Q a b,都要輸出一個(gè)結(jié)果,如果 a 和 b 在同一集合內(nèi),則輸出 Yes,否則輸出 No。
每個(gè)結(jié)果占一行。
數(shù)據(jù)范圍
1≤n,m≤105
輸入樣例:
4 5
M 1 2
M 3 4
Q 1 2
Q 1 3
Q 3 4
輸出樣例:
Yes
No
Yes
提交代碼
#include<iostream> using namespace std; const int N = 100010; int n, m; int p[N]; int find(int x) // 找到x的祖先節(jié)點(diǎn) { if (p[x] != x) p[x] = find(p[x]); return p[x]; } int main() { scanf("%d %d", &n, &m); for (int i = 1; i <= n; ++i) p[i] = i; while (m--) { char op; int a, b; scanf (" %c%d%d", &op, &a, &b); if (op == 'M') p[p[find(a)]] = find(b); // 讓a的祖先節(jié)點(diǎn)指向b的祖先節(jié)點(diǎn) else { if (find(a) == find(b)) puts("Yes"); else puts("No"); } } return 0; }
import java.io.*; public class Main { static int N = 100010; static int n, m; static int [] p = new int [N]; static int find(int x) { if (p[x] != x) p[x] = find(p[x]); return p[x]; } public static void main(String[] args) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader (System.in)); String [] str = reader.readLine().split(" "); n = Integer.parseInt(str[0]); m = Integer.parseInt(str[1]); for (int i = 1; i <= n; ++ i) p[i] = i; while (m -- > 0) { String op; int a, b; str = reader.readLine().split(" "); op = str[0]; a = Integer.parseInt(str[1]); b = Integer.parseInt(str[2]); if (op.equals("M")) p[find(a)] = find(b); else { if (find(a) == find(b)) System.out.println("Yes"); else System.out.println("No"); } } } }
總結(jié)
到此這篇關(guān)于java:無(wú)法訪問(wèn)org.springframework.boot.SpringApplication解決的文章就介紹到這了,更多相關(guān)java無(wú)法訪問(wèn)org.springframework.boot.SpringApplication內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
MyBatis insert操作插入數(shù)據(jù)之后返回插入記錄的id
今天小編就為大家分享一篇關(guān)于MyBatis插入數(shù)據(jù)之后返回插入記錄的id,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2019-03-03Hadoop運(yùn)行時(shí)遇到j(luò)ava.io.FileNotFoundException錯(cuò)誤的解決方法
今天給大家?guī)?lái)的是關(guān)于Java的相關(guān)知識(shí),文章圍繞著Hadoop運(yùn)行時(shí)遇到j(luò)ava.io.FileNotFoundException錯(cuò)誤展開(kāi),文中有非常詳細(xì)的解決方法,需要的朋友可以參考下2021-06-06解決springboot自定義注解AOP在controller上導(dǎo)致controller注入失敗問(wèn)題
這篇文章主要介紹了解決springboot自定義注解AOP在controller上導(dǎo)致controller注入失敗問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-10-10Java使用OpenCV3.2實(shí)現(xiàn)視頻讀取與播放
這篇文章主要為大家詳細(xì)介紹了Java使用OpenCV3.2實(shí)現(xiàn)視頻讀取與播放,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-07-07SpringBoot詳解整合MyBatis過(guò)程中可能遇到的問(wèn)題
因?yàn)镾pring Boot框架開(kāi)發(fā)的便利性,所以實(shí)現(xiàn)Spring Boot與數(shù)據(jù)訪問(wèn)層框架(例如MyBatis)的整合非常簡(jiǎn)單,主要是引入對(duì)應(yīng)的依賴啟動(dòng)器,并進(jìn)行數(shù)據(jù)庫(kù)相關(guān)參數(shù)設(shè)置即可2022-07-07