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

java實現(xiàn)即時通信的完整步驟分享

 更新時間:2020年09月09日 10:57:09   作者:氵何章懷曉 。  
這篇文章主要給大家介紹了關(guān)于java實現(xiàn)即時通信的完整步驟,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

前言

移動社交是我們?nèi)粘I钪泻艹R姷能浖?,最近在做即時通信,我用的是環(huán)信,和大家分享一下~~
環(huán)信的API都是基于JSON的,所以在構(gòu)造HTTP請求的時候,要指定請求頭


注意==》環(huán)信API必須攜帶token才可以訪問。

創(chuàng)建一個認證類

	public class Authentic {

 private static Token token = new Token();

 private TalkHttpService service;

 public Authentic(TalkHttpService service) {
 this.service = service;
 }

 public Authentic(TalkHttpService service, Token token) {
 this.service = service;
 if (token != null) {
  Authentic.token = token;
 }
 }

 public Token getToken() {
 this.flush();
 return token;
 }

 public void task() {
 this.flush();
 }

 /**
 * @describe 申請認證 POST PUT 這兩種請求攜帶參數(shù)
 * @author 何章懷曉 hezhanghuaixiao
 * @date 2020/9/8 17:02
 * @other
 */
 public void applyAuthentication(HttpEntityEnclosingRequestBase request) {
 this.flush();
 request.addHeader("Authorization", "Bearer " + token.toString());
 }
 /**
 * @describe 申請認證 GET DELETE 這兩種請求不攜帶參數(shù)
 * @author 何章懷曉 hezhanghuaixiao
 * @date 2020/9/8 17:02
 * @other
 */
 public void applyAuthentication(HttpRequestBase request) {
 this.flush();
 request.addHeader("Authorization", "Bearer " + token.toString());
 }

 private void flush() {
 synchronized (Authentic.class) {
  try {
  //如果超時
  if (token.isExpire()) {
   //判斷APPID和秘鑰信息
   if (_Global.APP_CLIENT_ID != null && _Global.APP_CLIENT_SECRET != null) {
   Map<String, Object> param = new HashMap<String, Object>();
   param.put("grant_type", "client_credentials");
   param.put("client_id", _Global.APP_CLIENT_ID);
   param.put("client_secret", _Global.APP_CLIENT_SECRET);
   //請求獲取token
   TalkNode res = service
    .request(_Global.URR_TOKEN, _Global.HTTP_METHOD_POST, param, null, null);
   //成功獲取token
   if (res != null && res.getAccess_token() != null && res.getExpires_in() != null
    && res.getExpires_in() > 0) {
    //賦值
    token = new Token(res.getAccess_token(),
     res.getExpires_in() * 1000 + System.currentTimeMillis());
   }
   }
  }
  } catch (Exception e) {
  e.printStackTrace();
  }
 }
 }

 public static class Token {

 private String token;
 private Long expire;

 public Token() {
 }

 public Token(String token, long expire) {
  this.token = token;
  this.expire = expire;
 }

 public String getToken() {
  return token;
 }

 public void setToken(String token) {
  this.token = token;
 }

 public Long getExpire() {
  return expire;
 }

 public void setExpire(Long expire) {
  this.expire = expire;
 }

 public boolean isExpire() {
  return expire == null || System.currentTimeMillis() > expire;
 }

 @Override
 public String toString() {
  return token;
 }
 }
}

創(chuàng)建請求接口

public interface TalkHttpService {
	/**
	 @describe
	 @param
		* @param url 請求地址

	 * @param method	請求方法

	 * @param param	參數(shù)

	 * @param auth	加密認證

	 * @param field	字段轉(zhuǎn)換
	 @return com.hedashi.protal.model.TalkNode
	 @author 何章懷曉 hezhanghuaixiao
	 @date 2020/9/8 17:21
	 @other
	 */
	 TalkNode request(String url, int method, Object param,
  Authentic auth, String[][] field) throws Exception;

	/**
	 @describe
	 @param
		* @param url 請求地址

	 * @param file	文件名稱

	 * @param auth	加密認證

	 * @param equal	字段轉(zhuǎn)換
	 @return com.hedashi.protal.model.TalkNode
	 @author 何章懷曉 hezhanghuaixiao
	 @date 2020/9/8 17:21
	 @other
	 */
	 TalkNode upload(String url, File file, Authentic auth,
  String[][] equal) throws Exception;


	/**
	 @describe
	 @param
		* @param url 請求地址

	 * @param file	文件名稱

	 * @param auth	加密認證

	 * @param header	請求頭
	 @return void
	 @author 何章懷曉 hezhanghuaixiao
	 @date 2020/9/8 17:21
	 @other
	 */
	 void downLoad(String url, File file, Authentic auth,
  Map<String, String> header) throws Exception;

}

創(chuàng)建全局變量對不同模塊操作

/*
 @describe 全局變量
 @params
 @return 
 @author 何章懷曉
 @date 2020/7/30 9:30
 @other
 */
public class _Global {
	
	public static String APP_KEY = "";
	public static String APP_CLIENT_ID = "";
	public static String APP_CLIENT_SECRET = "";
	//每頁數(shù)量
	public static int APP_PAGE_SIZE = 10;
	public static final int HTTP_METHOD_GET = 1;
	public static final int HTTP_METHOD_POST = 2;
	public static final int HTTP_METHOD_PUT = 3;
	public static final int HTTP_METHOD_DELETE = 4;
	public static final String URL_HOST = "http://a1.easemob.com/"+APP_KEY.replace("#","/")+"/";
	public static final String URR_TOKEN = URL_HOST+"token";
	public static final String URL_CHAT = URL_HOST+"chatmessages";
	public static final String URL_GROUP = URL_HOST+"chatgroups";
	public static final String URL_FILE = URL_HOST+"chatfiles";
	public static final String URL_ROOM = URL_HOST+"chatrooms";
	public static final String URL_MESSAGES = URL_HOST+"messages";
	public static final String URL_USER = URL_HOST+"users";
	
}

請求管理類

package com.hedashi.protal.service.impl;


import com.hedashi.protal.model.TalkNode;
import com.hedashi.protal.model.Authentic;
import com.hedashi.protal.service.TalkHttpService;
import com.hedashi.protal.util.JsonTool;
import com.hedashi.protal.util._Global;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.net.URI;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.stereotype.Service;

@Service
public class TalkHttpServiceImplApache implements TalkHttpService {
 /**
 @describe
 @param
 * @param url 請求路徑

 * @param method 方式

 * @param param 參數(shù)

 * @param auth 認證

 * @param field 將相應(yīng)結(jié)果封裝到本地
 @return com.hedashi.protal.model.TalkNode
 @author 何章懷曉 hezhanghuaixiao
 @date 2020/9/8 17:39
 @other
 */
 @Override
 public TalkNode request(String url, int method, Object param,
  Authentic auth, String[][] field) throws Exception {

 //獲得可關(guān)閉的連接
 CloseableHttpClient client = this.getClient();
 try {
  HttpResponse response = null;
  //區(qū)分請求方式
  switch (method) {
  case _Global.HTTP_METHOD_GET:
   //構(gòu)建請求
   HttpGet get = new HttpGet(url);
   if (auth != null) {
   //如果未認證 請求認證
   auth.applyAuthentication(get);
   }
   //固定請求頭信息為JSON
   get.addHeader("Content-Type", "application/json");
   response = client.execute(get);
   break;
  case _Global.HTTP_METHOD_POST:
   HttpPost post = new HttpPost(url);
   if (auth != null) {
   auth.applyAuthentication(post);
   }
   //POST攜帶參數(shù)
   if (param != null) {
   //參數(shù)編碼放入請求體
   post.setEntity(new StringEntity(JsonTool.write(param),
    "UTF-8"));
   }
   post.addHeader("Content-Type", "application/json");
   response = client.execute(post);
   break;
  case _Global.HTTP_METHOD_PUT:
   HttpPut put = new HttpPut(url);
   if (put != null) {
   auth.applyAuthentication(put);
   }
   if (param != null) {
   put.setEntity(new StringEntity(JsonTool.write(param),
    "UTF-8"));
   }
   put.addHeader("Content-Type", "application/json");
   response = client.execute(put);
   break;
  case _Global.HTTP_METHOD_DELETE:
   HttpDelete delete = new HttpDelete(url);
   if (auth != null) {
   auth.applyAuthentication(delete);
   }
   delete.addHeader("Content-Type", "application/json");
   response = client.execute(delete);
   break;
  default:
   throw new Exception("非法請求方式");
  }
  int code = response.getStatusLine().getStatusCode();
  //判斷返回code 如果為200
  if (code == HttpStatus.SC_OK) {
  //獲取響應(yīng)體
  HttpEntity entity = response.getEntity();
  if (entity != null) {
   //解析
   String json = EntityUtils.toString(entity, "UTF-8");
   if (field != null && field.length > 0) {
   for (String[] temp : field) {
    json = json.replace(temp[0], temp[1]);
   }
   }
   //解析為實體類
   TalkNode talkNode = (TalkNode) JsonTool.read(json, TalkNode.class);
   talkNode.setStatusCode(code);
   return talkNode;
  }
  } else {
  //非200將code返回
  return new TalkNode(code);
  }
 } catch (Exception e) {
  throw e;
 } finally {
  client.close();
 }
 return null;
 }

 @Override
 public TalkNode upload(String url, File file, Authentic auth,
  String[][] equal) throws Exception {
 CloseableHttpClient client = this.getClient();
 try {
  HttpPost post = new HttpPost();
  post.setURI(new URI(url));
  if (auth != null) {
  auth.applyAuthentication(post);
  }
  post.addHeader("restrict-access", "true");
  ContentBody body = new FileBody(file);
  MultipartEntity part = new MultipartEntity();
  part.addPart("file", body);
  post.setEntity(part);
  HttpResponse response = client.execute(post);
  int code = response.getStatusLine().getStatusCode();
  if (code == HttpStatus.SC_OK) {
  HttpEntity entity = response.getEntity();
  if (entity != null) {
   String json = EntityUtils.toString(entity, "UTF-8");
   if (equal != null && equal.length > 0) {
   for (String[] temp : equal) {
    json = json.replace(temp[0], temp[1]);
   }
   }

   TalkNode talkNode = (TalkNode) JsonTool.read(json, TalkNode.class);
   talkNode.setStatusCode(code);
   return talkNode;
  }
  }
 } catch (Exception e) {
  throw e;
 } finally {
  client.close();
 }
 return null;
 }

 @Override
 public void downLoad(String url, File file, Authentic auth,
  Map<String, String> header) throws Exception {
 CloseableHttpClient client = this.getClient();
 try {
  HttpGet get = new HttpGet();
  get.setURI(new URI(url));
  if (auth != null) {
  auth.applyAuthentication(get);
  }
  for (Entry<String, String> en : header.entrySet()) {
  get.addHeader(en.getKey(), en.getValue());
  }
  HttpResponse response = client.execute(get);
  if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
  HttpEntity entity = response.getEntity();
  if (entity != null) {
   InputStream in = entity.getContent();
   FileOutputStream fos = new FileOutputStream(file);
   byte[] data = new byte[10 * 1024];
   int len = 0;
   while ((len = in.read(data)) != -1) {
   fos.write(data, 0, len);
   }
   fos.flush();
   fos.close();
   in.close();
  }
  }
 } catch (Exception e) {
  throw e;
 } finally {
  client.close();
 }
 }

 private CloseableHttpClient getClient() {
 return HttpClients.createDefault();
 }
}

創(chuàng)建業(yè)務(wù)請求和響應(yīng)格式類

package com.hedashi.protal.model;

import java.util.List;
import java.util.Map;
/**
 @describe 根據(jù)不同的業(yè)務(wù)封裝不同的返回結(jié)果,該格式在發(fā)送請求的時候就被指定
 @author 何章懷曉 hezhanghuaixiao
 @date 2020/9/8 17:42
 @other
 */
public class TalkNode {

 public static final String[][] DATA_ENTITIES = new String[][]{{"entities", "entities_share"},
  {"share-secret", "share_secret"}};
 public static final String[][] DATA_ARRAY = new String[][]{{"data", "data_array"}};
 public static final String[][] DATA_LIST = new String[][]{{"data", "data_list"}};
 public static final String[][] DATA_MAP = new String[][]{{"data", "data_map"}};
 public static final String[][] DATA_CHAT_LIST = new String[][]{{"entities", "data_chat_list"}};
 public static final String[][] DATA_ROOM = new String[][]{{"data", "data_room"}};
 public static final String[][] DATA_ROOM_LIST = new String[][]{{"data", "data_room_list"},
  {"public", "public_room"}};
 public static final String[][] DATA_ROOM_REDO = new String[][]{{"data", "data_room_rodo"}};
 public static final String[][] DATA_ROOM_REDO_LIST = new String[][]{
  {"data", "data_room_redo_list"}};
 public static final String[][] DATA_GROUP = new String[][]{{"data", "data_group"}};
 public static final String[][] DATA_GROUP_UPDATE = new String[][]{{"data", "data_group_update"}};
 public static final String[][] DATA_GROUP_OWNER = new String[][]{{"data", "data_group_owner"}};
 public static final String[][] DATA_GROUP_LIST = new String[][]{{"data", "data_group_list"}};
 public static final String[][] DATA_GROUP_LIST_MEMBER = new String[][]{
  {"data", "data_group_list_member"}};
 public static final String[][] DATA_GROUP_LIST_NEW = new String[][]{
  {"data", "data_group_list_new"}, {"public", "public_group"}};
 public static final String[][] DATA_GROUP_FRIEND = new String[][]{{"data", "data_group_friend"}};
 public static final String[][] DATA_GROUP_FRIEND_LIST = new String[][]{
  {"data", "data_group_friend_list"}};
 private String access_token;
 private String action;
 private String application;
 private String applicationName;
 private Long count;
 private String cursor;
 private Integer duration;
 private Long expires_in;
 private String organization;
 private String path;
 private Integer statusCode;
 private Long timestamp;
 private String uri;
 private Map<String, Object> params;
 private TalkUser user;
 private List<TalkUser> entities;
 private String[] data_array;
 private Map<String, String> data_map;
 private List<Map<String, Object>> data_list;
 private List<TalkMsg> data_chat_list;
 private TalkRoom data_room;
 private List<TalkRoom> data_room_list;
 private TalkRoomRedo data_room_rodo;
 private List<TalkRoomRedo> data_room_redo_list;
 private TalkGroup data_group;
 private TalkGroupMember data_group_update;
 private TalkGroupMember data_group_owner;
 private List<TalkGroup> data_group_list;
 private List<TalkGroupMember> data_group_list_member;
 private List<TalkGroupNew> data_group_list_new;
 private TalkGroupFriend data_group_friend;
 private List<TalkGroupFriend> data_group_friend_list;

 public TalkNode() {
 }


 public TalkNode(Integer statusCode) {
 this.statusCode = statusCode;
 }

 public String getAccess_token() {
 return access_token;
 }

 public void setAccess_token(String access_token) {
 this.access_token = access_token;
 }

 public String getAction() {
 return action;
 }

 public void setAction(String action) {
 this.action = action;
 }

 public String getApplication() {
 return application;
 }

 public void setApplication(String application) {
 this.application = application;
 }

 public String getApplicationName() {
 return applicationName;
 }

 public void setApplicationName(String applicationName) {
 this.applicationName = applicationName;
 }

 public Long getCount() {
 return count;
 }

 public void setCount(Long count) {
 this.count = count;
 }

 public String getCursor() {
 return cursor;
 }

 public void setCursor(String cursor) {
 this.cursor = cursor;
 }

 public Integer getDuration() {
 return duration;
 }

 public void setDuration(Integer duration) {
 this.duration = duration;
 }

 public Long getExpires_in() {
 return expires_in;
 }

 public void setExpires_in(Long expires_in) {
 this.expires_in = expires_in;
 }

 public String getOrganization() {
 return organization;
 }

 public void setOrganization(String organization) {
 this.organization = organization;
 }

 public String getPath() {
 return path;
 }

 public void setPath(String path) {
 this.path = path;
 }

 public Integer getStatusCode() {
 return statusCode;
 }

 public void setStatusCode(Integer statusCode) {
 this.statusCode = statusCode;
 }

 public Long getTimestamp() {
 return timestamp;
 }

 public void setTimestamp(Long timestamp) {
 this.timestamp = timestamp;
 }

 public String getUri() {
 return uri;
 }

 public void setUri(String uri) {
 this.uri = uri;
 }

 public Map<String, Object> getParams() {
 return params;
 }

 public void setParams(Map<String, Object> params) {
 this.params = params;
 }

 public TalkUser getUser() {
 return user;
 }

 public void setUser(TalkUser user) {
 this.user = user;
 }

 public List<TalkUser> getEntities() {
 return entities;
 }

 public void setEntities(List<TalkUser> entities) {
 this.entities = entities;
 }

 public String[] getData_array() {
 return data_array;
 }

 public void setData_array(String[] data_array) {
 this.data_array = data_array;
 }

 public Map<String, String> getData_map() {
 return data_map;
 }

 public void setData_map(Map<String, String> data_map) {
 this.data_map = data_map;
 }

 public List<Map<String, Object>> getData_list() {
 return data_list;
 }

 public void setData_list(List<Map<String, Object>> data_list) {
 this.data_list = data_list;
 }

 public List<TalkMsg> getData_chat_list() {
 return data_chat_list;
 }

 public void setData_chat_list(List<TalkMsg> data_chat_list) {
 this.data_chat_list = data_chat_list;
 }

 public TalkRoom getData_room() {
 return data_room;
 }

 public void setData_room(TalkRoom data_room) {
 this.data_room = data_room;
 }

 public List<TalkRoom> getData_room_list() {
 return data_room_list;
 }

 public void setData_room_list(List<TalkRoom> data_room_list) {
 this.data_room_list = data_room_list;
 }

 public TalkRoomRedo getData_room_rodo() {
 return data_room_rodo;
 }

 public void setData_room_rodo(TalkRoomRedo data_room_rodo) {
 this.data_room_rodo = data_room_rodo;
 }

 public List<TalkRoomRedo> getData_room_redo_list() {
 return data_room_redo_list;
 }

 public void setData_room_redo_list(List<TalkRoomRedo> data_room_redo_list) {
 this.data_room_redo_list = data_room_redo_list;
 }

 public TalkGroup getData_group() {
 return data_group;
 }

 public void setData_group(TalkGroup data_group) {
 this.data_group = data_group;
 }

 public TalkGroupMember getData_group_update() {
 return data_group_update;
 }

 public void setData_group_update(TalkGroupMember data_group_update) {
 this.data_group_update = data_group_update;
 }

 public TalkGroupMember getData_group_owner() {
 return data_group_owner;
 }

 public void setData_group_owner(TalkGroupMember data_group_owner) {
 this.data_group_owner = data_group_owner;
 }

 public List<TalkGroup> getData_group_list() {
 return data_group_list;
 }

 public void setData_group_list(List<TalkGroup> data_group_list) {
 this.data_group_list = data_group_list;
 }

 public List<TalkGroupMember> getData_group_list_member() {
 return data_group_list_member;
 }

 public void setData_group_list_member(
  List<TalkGroupMember> data_group_list_member) {
 this.data_group_list_member = data_group_list_member;
 }

 public List<TalkGroupNew> getData_group_list_new() {
 return data_group_list_new;
 }

 public void setData_group_list_new(List<TalkGroupNew> data_group_list_new) {
 this.data_group_list_new = data_group_list_new;
 }

 public TalkGroupFriend getData_group_friend() {
 return data_group_friend;
 }

 public void setData_group_friend(TalkGroupFriend data_group_friend) {
 this.data_group_friend = data_group_friend;
 }

 public List<TalkGroupFriend> getData_group_friend_list() {
 return data_group_friend_list;
 }

 public void setData_group_friend_list(
  List<TalkGroupFriend> data_group_friend_list) {
 this.data_group_friend_list = data_group_friend_list;
 }
}

工具類

public class HuanXinUtil {

	private static TalkDataService service = null;

	/**
	 @describe 初始化
	 @param
		* @param
	 @return void
	 @author 何章懷曉 hezhanghuaixiao
	 @date 2020/9/8 17:26
	 @other
	 */
	private static void init(){

		if(service == null){
			
			// 初始服務(wù)端Token
			Authentic.Token token = new Authentic(new TalkHttpServiceImplApache()).getToken();
			//token和過期時間
			Authentic.Token TEST_TOKEN = new Authentic.Token(token.getToken(),token.getExpire());
			//新建一個鏈接服務(wù)
			service = new TalkDataServiceImpl(new TalkHttpServiceImplApache());
			// 修改數(shù)據(jù)業(yè)務(wù)Token
			service.setToken(TEST_TOKEN);
		}
	}

	/**
		 @describe 添加管理員
		 @param
		 * @param groupId 群組id

		 * @param userid 管理員id
		 @return boolean
		 @author 何章懷曉 hezhanghuaixiao
		 @date 2020/9/8 17:54
		 @other
		 */
	public static boolean addGroupManager(String groupId,String userid) {
		try {
			init();
			TalkNode talkNode = service.addGroupManager(groupId,userid);
			if(talkNode.getStatusCode()==200){
				return true;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}
	}

service調(diào)用

 @Override
 public TalkNode addGroupManager(String id, String userId) throws Exception {
 Map<String, Object> param = new HashMap<String, Object>();
 param.put("newadmin", userId);
 return service.request(_Global.URL_GROUP + "/" + id + "/admin",
  _Global.HTTP_METHOD_POST, param, auth, TalkNode.DATA_GROUP);
 }
 /**
 * @param [groupId, managerId]
 * @return com.hedashi.common.api.CommonResult
 * @describe 后臺添加群組管理員
 * @author 何章懷曉 hezhanghuaixiao
 * @date 2020/9/8 14:28
 * @other
 */
 @Override
 public CommonResult addGroupManager(String groupId, String managerId) {
 boolean b = HuanXinUtil.addGroupManager(groupId, managerId);
 if(b){
  System.out.println("環(huán)信添加管理員成功==========================");
  //本地添加管理員
  addGroupAdmin(groupId,managerId);
  return CommonResult.success("SUCCESS");
 }
 return CommonResult.failed("FAILED");
 }
 @ApiOperation(value = "群組添加管理員")
 @RequestMapping(value = "/addGroupManager", method = RequestMethod.POST)
 @ResponseBody
 public CommonResult<HeAdmin> addGroupManager(
  @RequestParam @ApiParam(value = "群組環(huán)信ID", required = true) String groupId,
  @RequestParam @ApiParam(value = "管理員環(huán)信id", required = true) String managerId
 ) {
 return heUGroupService.addGroupManager(groupId,managerId);
 }

swagger調(diào)用

token 信息

{“application”:“53e3eeb5-6926-46dd-bc61-4e214342ef7e”,“access_token”:“YWMtXDS-uPG6EeqItFktBQxljAAAAAAAAAAAAAAAAAAAAAFT4-61aSZG3bxhTiFDQu9-AgMAAAF0bSppWwBPGgBXDkgrlvguBLEe966D_LnbgNyNz2OOsTgP4okhQGoOdA”,“expires_in”:5184000}

swagger返回結(jié)果

控制臺


數(shù)據(jù)庫:

總結(jié)

到此這篇關(guān)于java實現(xiàn)即時通信的文章就介紹到這了,更多相關(guān)java實現(xiàn)即時通信內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • 基于SpringBoot上傳任意文件功能的實現(xiàn)

    基于SpringBoot上傳任意文件功能的實現(xiàn)

    下面小編就為大家?guī)硪黄赟pringBoot上傳任意文件功能的實現(xiàn)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-08-08
  • Java實現(xiàn)藍橋杯數(shù)獨游戲的示例代碼

    Java實現(xiàn)藍橋杯數(shù)獨游戲的示例代碼

    這篇文章主要介紹了Java實現(xiàn)藍橋杯數(shù)獨游戲的示例代碼,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-02-02
  • SpringBoot?SpringSecurity?詳細介紹(基于內(nèi)存的驗證)

    SpringBoot?SpringSecurity?詳細介紹(基于內(nèi)存的驗證)

    這篇文章主要介紹了SpringBoot?SpringSecurity?介紹(基于內(nèi)存的驗證),本文通過實例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-04-04
  • java代碼如何實現(xiàn)存取數(shù)據(jù)庫的blob字段

    java代碼如何實現(xiàn)存取數(shù)據(jù)庫的blob字段

    這篇文章主要介紹了java代碼如何實現(xiàn)存取數(shù)據(jù)庫的blob字段問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2025-04-04
  • SpringBoot熱部署Springloaded實現(xiàn)過程解析

    SpringBoot熱部署Springloaded實現(xiàn)過程解析

    這篇文章主要介紹了SpringBoot熱部署Springloaded實現(xiàn)過程解析,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2020-03-03
  • 利用Java多線程技術(shù)導(dǎo)入數(shù)據(jù)到Elasticsearch的方法步驟

    利用Java多線程技術(shù)導(dǎo)入數(shù)據(jù)到Elasticsearch的方法步驟

    這篇文章主要介紹了利用Java多線程技術(shù)導(dǎo)入數(shù)據(jù)到Elasticsearch的方法步驟,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-07-07
  • Java中的BlockingQueue接口源碼解析

    Java中的BlockingQueue接口源碼解析

    這篇文章主要介紹了Java中的BlockingQueue接口源碼解析,BlockingQueue接口表示阻塞隊列,是Java并發(fā)包中阻塞隊列的接口定義規(guī)范,阻塞隊列意味著對于該隊列的操作是線程安全的,當(dāng)多個線程存放元素進入隊列或者從隊列中取出元素都是線程安全的,需要的朋友可以參考下
    2023-11-11
  • Java中的Phaser并發(fā)階段器詳解

    Java中的Phaser并發(fā)階段器詳解

    這篇文章主要介紹了Java中的Phaser并發(fā)階段器詳解,Phaser由JDK1.7提出,是一個復(fù)雜強大的同步輔助類,是對同步工具類CountDownLatch和CyclicBarrier的綜合升級,能夠支持分階段實現(xiàn)等待的業(yè)務(wù)場景,需要的朋友可以參考下
    2023-12-12
  • SpringBoot讀取resource文件代碼實例

    SpringBoot讀取resource文件代碼實例

    這篇文章主要介紹了SpringBoot讀取resource文件代碼實例,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
    2020-04-04
  • Java中的轉(zhuǎn)換流、壓縮流、序列化流、打印流及應(yīng)用場景

    Java中的轉(zhuǎn)換流、壓縮流、序列化流、打印流及應(yīng)用場景

    這篇文章主要介紹了Java中的轉(zhuǎn)換流、壓縮流、序列化流、打印流及應(yīng)用場景,本文結(jié)合示例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-06-06

最新評論

望都县| 梁平县| 金华市| 云林县| 恭城| 城步| 巴中市| 鱼台县| 巨野县| 泸水县| 昌都县| 太仆寺旗| 磴口县| 武夷山市| 海原县| 辽源市| 长寿区| 边坝县| 石阡县| 蚌埠市| 南阳市| 株洲市| 大冶市| 兴业县| 静宁县| 金塔县| 定南县| 东乌珠穆沁旗| 自贡市| 昭觉县| 兴文县| 珠海市| 花垣县| 三穗县| 蒙阴县| 哈尔滨市| 望城县| 尉犁县| 荣昌县| 永善县| 南昌县|