jdbc實(shí)現(xiàn)寵物商店管理系統(tǒng)
用jdbc實(shí)現(xiàn)寵物商店管理系統(tǒng)
1.開(kāi)發(fā)語(yǔ)言:Java
2.開(kāi)發(fā)工具:eclipse,MySql數(shù)據(jù)庫(kù)
3.開(kāi)發(fā)環(huán)境:jdk1.8
4.操作系統(tǒng):win10
這里是運(yùn)行圖片,代碼在圖片下面







這里是主程序測(cè)試類Test
// Main
package petStore1;
public class Test {
public static void main(String[] args) {
System.out.println("寵物商店啟動(dòng)");
PetManage pm=new PetManage();
pm.showAll();
}
}
這里是工具類BaseDAO
用來(lái)對(duì)數(shù)據(jù)庫(kù)進(jìn)行增刪改查的一個(gè)工具類
// BaseDAO
package petStore1;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class BaseDAO {
public Connection conn = null;
public PreparedStatement state = null;
public ResultSet rs = null;
public Connection getConnection() {
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/petshop", "root", "123");
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}
public int update(String sql, Object...obs) throws SQLException {
int result = 0;
conn = getConnection();
state = conn.prepareStatement(sql);
for (int i = 0; i < obs.length; i++) {
state.setObject(i + 1, obs[i]);
}
result = state.executeUpdate();
return result;
}
public ResultSet search(String sql, Object...obs) {
try {
conn = getConnection();
state = conn.prepareStatement(sql);
for (int i = 0; i < obs.length; i++) {
state.setObject(i + 1, obs[i]);
}
rs = state.executeQuery();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return rs;
}
public void closeObject1() {
try {
if (rs != null) {
rs.close();
}
if (state != null) {
state.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
public void closeObject2(AutoCloseable... obs) {
try {
for (int i = 0; i < obs.length; i++) {
if (obs[i] != null) {
obs[i].close();
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
這里是要用到的所有方法的一個(gè)類PetManage
因?yàn)槲疫€沒(méi)學(xué)怎么合理的把各種類放到各個(gè)包,以及框架什么的,我暫時(shí)先放在一個(gè)類里面了,繁雜且無(wú)序,抱歉
package petStore1;
import java.sql.Connection;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.InputMismatchException;
import java.util.Scanner;
public class PetManage extends BaseDAO{
public void showAll(){
showPetName();
showPetOwner();
showPetStore();
login();
}
/**
* 顯示寵物的姓名以及ID方法
*/
public void showPetName(){
conn=getConnection();
String sql="SELECT ID,name from pet";
try {
state=conn.prepareStatement(sql);
rs=state.executeQuery();
System.out.println("Wonderland醒來(lái),所有寵物從MySQL中醒來(lái)");
System.out.println("*************************************");
while(rs.next()){
int id=rs.getInt("ID");
String name=rs.getString("name");
System.out.println("第"+id+"只寵物,名字叫:"+name);
}
System.out.println("*************************************\n");
} catch (Exception e) {
e.printStackTrace();
}finally{
closeObject1();
}
}
/**
* 顯示寵物主人方法
*/
public void showPetOwner(){
conn=getConnection();
String sql="SELECT pet.ID,petowner.name from petowner,pet where petowner.ID=owner_id";
try {
state=conn.prepareStatement(sql);
rs=state.executeQuery();
System.out.println("所有寵物主人從MySQL中醒來(lái)");
System.out.println("*************************************");
while(rs.next()){
int id=rs.getInt("pet.ID");
String name=rs.getString("petowner.name");
System.out.println("第"+id+"只寵物主人,名字叫:"+name);
}
System.out.println("*************************************\n");
} catch (Exception e) {
e.printStackTrace();
}finally{
closeObject1();
}
}
/**
* 顯示寵物商店方法
*/
public void showPetStore(){
conn=getConnection();
String sql="SELECT name from petstore";
try {
state=conn.prepareStatement(sql);
rs=state.executeQuery();
System.out.println("所有寵物商店從MySQL中醒來(lái)");
System.out.println("*************************************");
while(rs.next()){
String name=rs.getString("name");
System.out.println("我的名字叫:"+name);
}
System.out.println("*************************************\n");
} catch (Exception e) {
e.printStackTrace();
}finally{
closeObject1();
}
}
/**
* 登錄界面選擇是主人登錄還是商店登錄方法
*/
public void login(){
System.out.println("請(qǐng)選擇輸入登錄模式\n1.寵物主人登錄\n2.寵物商店登錄\n3.退出系統(tǒng)\n-------------------");
try {
Scanner input=new Scanner(System.in);
int choise=input.nextInt();
if(choise<1|| choise>3){
System.out.println("輸入有誤,請(qǐng)重新選擇");
login();
}else{
switch (choise) {
case 1:
petOwnerLogin();
break;
case 2:
petStoreLogin();
break;
case 3:
System.out.println("謝謝使用");
System.exit(0);
break;
default:
break;
}
}
} catch (InputMismatchException e) {
System.out.println("輸入有誤,請(qǐng)重新選擇");
login();
}
}
/**
* 寵物主人登錄方法
* @return
*/
public boolean petOwnerLogin(){
boolean flag=false;
try {
Scanner input=new Scanner(System.in);
System.out.println("請(qǐng)先登錄,請(qǐng)您先輸入主人的名字");
String name=input.next();
System.out.println("請(qǐng)您輸入主人的密碼:");
String password=input.next();
conn=getConnection();
String sql="SELECT name from petowner where name=? and password=?";
try {
state=conn.prepareStatement(sql);
state.setString(1, name);
state.setString(2, password);
rs=state.executeQuery();
if(rs.next()){
System.out.println("---------恭喜您成功登錄!---------");
System.out.println("----------您的基本信息---------");
conn=getConnection();
String sql2="SELECT ID,name,money from petowner where name=?";
// state=conn.prepareStatement(sql2);
// state.setString(1, name);
// rs=state.executeQuery();
rs=search(sql2,name);
if(rs.next()){
int uid=rs.getInt("ID");
String uname=rs.getString("name");
Double uMoney=rs.getDouble("money");
System.out.println("姓名:"+uname);
System.out.println("元寶數(shù):"+uMoney);
System.out.print("登錄成功,");
dealPet(uname,uid);
}
}else{
System.out.println("登錄失敗,賬戶與密碼不匹配");
login();
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (InputMismatchException e) {
System.out.println("輸入有誤");
login();
}
return false;
}
/**
* 選擇買寵物或者賣寵物的方法
*/
public void dealPet(String ownerName,int uid) {
System.out.println("您可以購(gòu)買和賣出寵物,購(gòu)買寵物請(qǐng)輸入1,賣出寵物請(qǐng)輸入2\n1.購(gòu)買寵物\n2.賣出寵物\n3.返回上一級(jí)");
try {
Scanner input2=new Scanner(System.in);
int choise2=input2.nextInt();
if(choise2<1||choise2>3){
System.out.println("輸入有誤");
dealPet(ownerName,uid);
}else{
switch (choise2) {
case 1:
//購(gòu)買寵物
buyPet(ownerName,uid);
break;
case 2:
//出售寵物
showSellPet(ownerName,uid);
break;
case 3:
//返回上一級(jí)
login();
break;
default:
break;
}
}
} catch (InputMismatchException e) {
System.out.println("輸入有誤");
dealPet(ownerName,uid);
}
}
/**
* 顯示主人擁有的寵物
*/
public void showSellPet(String ownerName,int uid) {
conn=getConnection();
String sql25="SELECT pet.ID,pet.name from petowner,pet where petowner.ID=owner_id and petowner.ID="+uid+"";
try {
state=conn.prepareStatement(sql25);
rs=state.executeQuery();
System.out.println("以下是你擁有的寵物:");
// //如果結(jié)果集為空,即該主人沒(méi)有寵物,就返回上一級(jí)進(jìn)行選擇
// if(!rs.next()){
// System.out.println("您沒(méi)有寵物,將自動(dòng)返回上一級(jí)");
// buyPet(ownerName, uid);
// }
while(rs.next()){
int petid=rs.getInt("pet.ID");
String petName=rs.getString("pet.name");
System.out.println("這是"+petid+"號(hào)寵物,名字叫:"+petName);
}
System.out.println("**************************************");
} catch (SQLException e) {
e.printStackTrace();
}
closeObject1();
sellPet(ownerName, uid);
}
public void sellPet(String ownerName,int uid) {
System.out.println("請(qǐng)輸入你想賣出的寵物序號(hào):");
try {
Scanner input27=new Scanner(System.in);
int choisePetId=input27.nextInt();
System.out.println("請(qǐng)輸入你要賣給的商店\n1.北京西苑\t2.重慶觀音橋");
int choiseStore=input27.nextInt();
String sql30="SELECT pet.ID,pet.name from petowner,pet where petowner.ID=owner_id and petowner.ID="+uid+" and pet.ID="+choisePetId+"";
Connection conn6=getConnection();
try {
state=conn6.prepareStatement(sql30);
rs=state.executeQuery();
if(rs.next()){
Connection conn9=getConnection();
conn9.setAutoCommit(false);
String sql40="UPDATE pet set owner_id=null,store_id="+choiseStore+" where pet.ID="+choisePetId+"";
state=conn9.prepareStatement(sql40);
int result20=state.executeUpdate();
String sql41="update petowner set money=money+5 where petowner.ID="+uid+"";
state=conn9.prepareStatement(sql41);
int result21=state.executeUpdate();
String sql42="update petstore set balance=balance-5 where petstore.ID="+choiseStore+"";
state=conn9.prepareStatement(sql42);
int result22=state.executeUpdate();
//獲得當(dāng)前時(shí)間
Long time1=System.currentTimeMillis();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
String dealTime=sdf.format(time1);
//將該條交易添加至交易賬單中
String sql43="insert into account (deal_type,pet_id,seller_id,buyer_id,price,deal_time) VALUES (2,"+choisePetId+","+choiseStore+","+uid+",5,'"+dealTime+"')";
state=conn9.prepareStatement(sql43);
int result23=state.executeUpdate();
if(result20>0 && result21>0 && result22>0 & result23>0){
//提交事務(wù)
conn9.commit();
System.out.println("賣出成功");
}else{
//回滾事務(wù)
conn9.rollback();
}
dealPet(ownerName,uid);
}else{
System.out.println("沒(méi)有該寵物,賣出失敗");
dealPet(ownerName,uid);
}
} catch (SQLException e) {
e.printStackTrace();
}
} catch (InputMismatchException e) {
System.out.println("輸入錯(cuò)誤,請(qǐng)重新輸入");
sellPet(ownerName, uid);
}
}
// /**
// * 顯示新培育寵物并且購(gòu)買
// */
// public void showNewPet() {
// // TODO Auto-generated method stub
//
// }
/**
* 寵物商店登錄的方法
* @return
*/
public boolean petStoreLogin(){
boolean flag=false;
try {
Scanner input=new Scanner(System.in);
System.out.println("請(qǐng)先登錄,請(qǐng)您先輸入寵物商店的名字");
String name=input.next();
System.out.println("請(qǐng)您輸入寵物商店的密碼:");
String password=input.next();
conn=getConnection();
String sq110="SELECT name,balance from petstore where name=? and password=?";
state=conn.prepareStatement(sq110);
rs=search(sq110, name,password);
if(rs.next()){
System.out.println("登錄成功");
PetStoreMake(name);
}else{
System.out.println("登錄失敗");
login();
}
} catch (Exception e) {
// TODO: handle exception
}
return false;
}
/*
* 寵物商店培育新寵物
*/
public void PetStoreMake(String storeName) throws SQLException {
System.out.println("請(qǐng)輸入數(shù)字進(jìn)行選擇:\n1.查詢店內(nèi)寵物\n2.培育新寵物\n3.退出登錄");
try {
Scanner input=new Scanner(System.in);
int choise7=input.nextInt();
if(choise7<1||choise7>3){
System.out.println("輸入有誤");
PetStoreMake(storeName);
}else{
switch (choise7) {
case 1:
storePetQuery(storeName);
break;
case 2:
storeAddPet(storeName);
break;
case 3:
//退出登錄,返回上一級(jí)
login();
break;
default:
break;
}
}
} catch (InputMismatchException e) {
System.out.println("輸入有誤");
PetStoreMake(storeName);
}
}
/**
* 寵物商店培育新寵物的方法
* @param storeName
* @throws SQLException
*/
public void storeAddPet(String storeName) throws SQLException {
System.out.println("請(qǐng)輸入你想添加的寵物的類型:");
Scanner input=new Scanner(System.in);
String typename=input.next();
System.out.println("請(qǐng)輸入該寵物的名字:");
String petname=input.next();
//查詢?cè)撋痰甑腎D
String sql14="SELECT ID from petstore where name='"+storeName+"'";
rs=search(sql14);
int id=0;
if(rs.next()){
id=rs.getInt("ID");
}
conn=getConnection();
String sql13="insert into pet (name,typename,health,love,birthday,store_id,neworold)VALUES(?,?,1,100,?,"+id+",'new')";
//獲取當(dāng)前時(shí)間,作為寵物的生日
Long time1=System.currentTimeMillis();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
String birth=sdf.format(time1);
int a=update(sql13, petname,typename,birth);
if(a>0){
System.out.println("培育新寵物成功");
PetStoreMake(storeName);
}else{
System.out.println("培育新寵物失敗");
PetStoreMake(storeName);
}
}
/**
* 在商店登錄之后進(jìn)行對(duì)店內(nèi)的寵物進(jìn)行查詢
* @param storeName
*/
public void storePetQuery(String storeName) {
System.out.println("正在查詢店內(nèi)寵物。。。");
conn=getConnection();
String sql11="SELECT pet.ID,pet.name,typename,birthday from pet,petstore where petstore.name=? and pet.store_id=petstore.ID";
try {
state=conn.prepareStatement(sql11);
rs=search(sql11, storeName);
int i=1;
while(rs.next()){
int id=rs.getInt("pet.ID");
String name=rs.getString("pet.name");
String typename=rs.getString("typename");
String birthday=rs.getString("birthday");
System.out.println("第"+i+"只寵物名字:"+name+",寵物類型:"+typename+",生日:"+birthday);
i++;
}
System.out.println("----------------------------");
PetStoreMake(storeName);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*購(gòu)買寵物的方法
*/
public void buyPet(String ownerName,int uid){
System.out.println("請(qǐng)輸入選擇購(gòu)買范圍,只輸入選擇項(xiàng)的序號(hào)");
System.out.println("1:購(gòu)買庫(kù)存寵物\n2.購(gòu)買新培育寵物\n3.返回上一級(jí)");
try {
Scanner input3=new Scanner(System.in);
int choise5=input3.nextInt();
if(choise5<1 || choise5>3){
System.out.println("輸入有誤");
buyPet(ownerName,uid);
}else{
switch (choise5) {
case 1:
showPetAll(ownerName,uid);
break;
case 2:
buyNewPet(ownerName,uid);
break;
case 3:
//返回上一級(jí)
dealPet(ownerName, uid);
break;
default:
break;
}
}
} catch (InputMismatchException e) {
System.out.println("輸入有誤");
buyPet(ownerName,uid);
}
}
public void buyNewPet(String ownerName,int uid) {
//用于判斷查詢是否有結(jié)果
boolean havePet=false;
System.out.println("正在幫你查詢新寵物。。。。。");
conn=getConnection();
String sql31="SELECT pet.ID,pet.name from pet where pet.neworold='new'";
try {
state=conn.prepareStatement(sql31);
rs=state.executeQuery();
while(rs.next()){
int petid=rs.getInt("pet.ID");
String petName=rs.getString("pet.name");
System.out.println("序號(hào)為:"+petid+",名字為:"+petName);
havePet=true;
}
if(havePet){
System.out.println("請(qǐng)輸入你要購(gòu)買的新寵物的序號(hào):");
try {
// boolean havePet2=false;
Scanner input28=new Scanner(System.in);
int newPetId=input28.nextInt();
Connection conn7=getConnection();
String sql32="SELECT pet.ID,pet.name,pet.store_id from pet where pet.neworold='new' and pet.ID="+newPetId+"";
state=conn7.prepareStatement(sql32);
rs=state.executeQuery();
if(rs.next()){
int storeid=rs.getInt("pet.store_id");
Connection conn8=getConnection();
conn8.setAutoCommit(false);
String sql33="UPDATE pet set pet.neworold='old',pet.owner_id="+uid+",pet.store_id=null where pet.ID="+newPetId+"";
String sql34="update petowner set money=money-5 where petowner.ID="+uid+"";
String sql35="update petstore set balance=balance+5 where petstore.ID="+storeid+"";
//獲得當(dāng)前時(shí)間
Long time1=System.currentTimeMillis();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
String dealTime=sdf.format(time1);
//將該條交易添加至交易賬單中
String sql36="insert into account (deal_type,pet_id,seller_id,buyer_id,price,deal_time) VALUES (1,"+newPetId+","+storeid+","+uid+",5,'"+dealTime+"')";
state=conn8.prepareStatement(sql33);
int result13=state.executeUpdate();
state=conn8.prepareStatement(sql34);
int result14=state.executeUpdate();
state=conn8.prepareStatement(sql35);
int result15=state.executeUpdate();
state=conn8.prepareStatement(sql36);
int result16=state.executeUpdate();
if(result13>0 && result14>0 && result15>0 && result16>0){
//如果都成功執(zhí)行,改變數(shù)據(jù),那就提交事務(wù)
conn8.commit();
System.out.println("購(gòu)買成功");
}else{
//如果中加你有一條沒(méi)有執(zhí)行成功那就回滾事務(wù)
conn8.rollback();
}
buyPet(ownerName, uid);
}else{
System.out.println("輸入錯(cuò)誤,沒(méi)有該序號(hào)的新寵物");
buyNewPet(ownerName, uid);
}
} catch (InputMismatchException e) {
e.printStackTrace();
}
}else{
System.out.println("暫時(shí)還沒(méi)新寵物");
buyPet(ownerName, uid);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
/**
* 展示寵物名字,序號(hào),類型的方法
*/
public void showPetAll(String ownerName,int uid) {
System.out.println("---------以下是庫(kù)存寵物--------");
conn=getConnection();
String sql6="SELECT pet.ID,pet.name,pet.typename from pet,petstore where pet.store_id=petstore.ID";
try {
state=conn.prepareStatement(sql6);
rs=state.executeQuery();
while(rs.next()){
int petId=rs.getInt("ID");
String petName=rs.getString("name");
String petType=rs.getString("typename");
System.out.println("序號(hào):"+petId+",我的名字叫:"+petName+",我是:"+petType+",要購(gòu)買我要花:5.0個(gè)元寶");
}
System.out.println("請(qǐng)輸入你想購(gòu)買的寵物編號(hào):");
try {
Scanner input17=new Scanner(System.in);
int choise6=input17.nextInt();
//對(duì)在商店里的寵物進(jìn)行ID查詢,符合的就購(gòu)買
conn=getConnection();
String sql15="SELECT pet.ID,pet.name,pet.typename,petstore.ID from pet,petstore where pet.store_id=petstore.ID and pet.ID="+choise6+"";
try {
state=conn.prepareStatement(sql15);
rs=state.executeQuery();
if(rs.next()){
//這里是寵物主人購(gòu)買寵物的代碼,將寵物的store_ID設(shè)置為null,將寵物的owner_ID設(shè)置為購(gòu)買主人的ID
//然后主人賬戶減錢,商店的結(jié)余加錢,將該條交易添加至交易賬單中
int store_id=rs.getInt("petstore.ID");//這里是選擇的寵物所屬商店的ID
//這里用創(chuàng)建一個(gè)新的連接
Connection conn1=getConnection();
//開(kāi)啟事務(wù)
conn1.setAutoCommit(false);
//將寵物的store_ID設(shè)置為null,將寵物的owner_ID設(shè)置為購(gòu)買主人的ID
String sql18="update pet set owner_id=1,store_id=NULL where pet.ID="+choise6+"";
//寵物主人減錢
String sql19="update petowner set money=money-5 where petowner.ID="+uid+"";
//寵物商店加錢
String sql20="update petstore set balance=balance+5 where petstore.ID="+store_id+"";
//獲得當(dāng)前時(shí)間
Long time1=System.currentTimeMillis();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
String dealTime=sdf.format(time1);
//將該條交易添加至交易賬單中
String sql21="insert into account (deal_type,pet_id,seller_id,buyer_id,price,deal_time) VALUES (1,"+choise6+","+store_id+","+uid+",5,'"+dealTime+"')";
state=conn1.prepareStatement(sql18);
int result2=state.executeUpdate();
state=conn1.prepareStatement(sql19);
int result3=state.executeUpdate();
state=conn1.prepareStatement(sql20);
int result4=state.executeUpdate();
state=conn1.prepareStatement(sql21);
int result5=state.executeUpdate();
if(result2>0 && result3>0 && result4>0 && result5>0){
//如果都成功執(zhí)行,改變數(shù)據(jù),那就提交事務(wù)
conn1.commit();
System.out.println("購(gòu)買成功");
}else{
//如果中加你有一條沒(méi)有執(zhí)行成功那就回滾事務(wù)
conn1.rollback();
}
//返回上一級(jí)
buyPet(ownerName,uid);
}else{
System.out.println("購(gòu)買失敗");
//返回上一級(jí)
buyPet(ownerName,uid);
}
} catch (SQLException e) {
e.printStackTrace();
}
} catch (InputMismatchException e) {
System.out.println("輸入有誤");
showPetAll(ownerName,uid);
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
我是一個(gè)java學(xué)習(xí)路上的小白,現(xiàn)在才剛剛開(kāi)始學(xué),以后學(xué)習(xí)的路還有很遠(yuǎn),用剛學(xué)的jdbc來(lái)做了一個(gè)案例,做的不好的見(jiàn)諒,因?yàn)槲乙矝](méi)時(shí)間去進(jìn)行優(yōu)化、升級(jí),只是希望寫在這里以后我還能有個(gè)回憶,以及給看的人可能帶來(lái)一點(diǎn)點(diǎn)小收獲。
更多學(xué)習(xí)資料請(qǐng)關(guān)注專題《管理系統(tǒng)開(kāi)發(fā)》。
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
- 詳解Java的JDBC中Statement與PreparedStatement對(duì)象
- JDBC之PreparedStatement類中預(yù)編譯的綜合應(yīng)用解析
- JDBCTM 指南:入門6-PreparedStatement
- Oracle JDBC連接BUG解決方案
- JDBC查詢Map轉(zhuǎn)對(duì)象實(shí)現(xiàn)過(guò)程詳解
- Jmeter基于JDBC請(qǐng)求實(shí)現(xiàn)MySQL數(shù)據(jù)庫(kù)測(cè)試
- Java如果通過(guò)jdbc操作連接oracle數(shù)據(jù)庫(kù)
- JDBC PreparedStatement Like參數(shù)報(bào)錯(cuò)解決方案
相關(guān)文章
Spring Cloud分布式定時(shí)器之ShedLock的實(shí)現(xiàn)
這篇文章主要介紹了Spring Cloud分布式定時(shí)器之ShedLock的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-03-03
SpringBoot+Dubbo+Zookeeper實(shí)現(xiàn)簡(jiǎn)單分布式開(kāi)發(fā)的應(yīng)用詳解
這篇文章主要介紹了SpringBoot+Dubbo+Zookeeper實(shí)現(xiàn)簡(jiǎn)單分布式開(kāi)發(fā)的應(yīng)用詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-01-01
Java 常用類解析:java異常機(jī)制,異常棧,異常處理方式,異常鏈,異常丟失詳解
這篇文章主要介紹了Java 常用類解析:java異常機(jī)制,異常棧,異常處理方式,異常鏈,異常丟失詳解的相關(guān)資料,需要的朋友可以參考下2017-03-03
SpringCloud?服務(wù)注冊(cè)中的nacos實(shí)現(xiàn)過(guò)程
這篇文章主要介紹了SpringCloud?服務(wù)注冊(cè)之nacos實(shí)現(xiàn)過(guò)程,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-03-03
Springboot如何實(shí)現(xiàn)自定義異常數(shù)據(jù)
這篇文章主要介紹了Springboot如何實(shí)現(xiàn)自定義異常數(shù)據(jù),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-09-09
Springboot啟動(dòng)同時(shí)創(chuàng)建數(shù)據(jù)庫(kù)和表實(shí)現(xiàn)方法
這篇文章主要介紹了Springboot啟動(dòng)同時(shí)創(chuàng)建數(shù)據(jù)庫(kù)和表,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧2023-01-01
Eclipse+Java+Swing+Mysql實(shí)現(xiàn)電影購(gòu)票系統(tǒng)(詳細(xì)代碼)
這篇文章主要介紹了Eclipse+Java+Swing+Mysql實(shí)現(xiàn)電影購(gòu)票系統(tǒng)并附詳細(xì)的代碼詳解,需要的小伙伴可以參考一下2022-01-01
解決@CachePut設(shè)置的key值無(wú)法與@CacheValue的值匹配問(wèn)題
這篇文章主要介紹了解決@CachePut設(shè)置的key的值無(wú)法與@CacheValue的值匹配問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-12-12
SpringBoot Admin 如何實(shí)現(xiàn)Actuator端點(diǎn)可視化監(jiān)控
這篇文章主要介紹了SpringBoot Admin 如何實(shí)現(xiàn)Actuator端點(diǎn)可視化監(jiān)控,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-08-08
idea注入mapper報(bào)錯(cuò)報(bào)紅的幾種解決方案
相信大家在使用idea的時(shí)候一定會(huì)遇到這樣的問(wèn)題,就是在service里注入mapper的時(shí)候,明明代碼沒(méi)有問(wèn)題,也可以運(yùn)行,但是idea它就是給你報(bào)個(gè)錯(cuò),有個(gè)紅色的波浪線在下面,所以本文將給大家介紹了idea注入mapper報(bào)錯(cuò)報(bào)紅的幾種解決方案,需要的朋友可以參考下2023-12-12

