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

SpringBoot集成極光推送完整實現(xiàn)代碼

 更新時間:2021年12月31日 10:39:23   作者:公眾號-老炮說Java  
本文主要介紹了SpringBoot集成極光推送完整實現(xiàn)代碼,文中通過示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

工作中經(jīng)常會遇到服務(wù)器向App推送消息的需求,一般企業(yè)中選擇用極光推送的比較多,在集成極光時發(fā)現(xiàn)極光的文檔并不完整,網(wǎng)上的文章也很多不能直接使用,這里列出我在工作中集成極光的全部代碼,只需要按照如下代碼保證一次性實現(xiàn)。

1.pom.xml

<!-- 極光推送 begin -->
<dependency>
    <groupId>cn.jpush.api</groupId>
    <artifactId>jpush-client</artifactId>
    <version>3.3.10</version>
</dependency>
<dependency>
    <groupId>cn.jpush.api</groupId>
    <artifactId>jiguang-common</artifactId>
    <version>1.1.4</version>
</dependency>
<!-- 極光推送 end -->

2.application.yml

jpush:
  appKey: xxx
  masterSecret: xxxx
  apnsProduction: false   # 是否生成環(huán)境,true表示生成環(huán)境

3.MyJPushClient

import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
import cn.jpush.api.JPushClient;
import cn.jpush.api.push.PushResult;
import cn.jpush.api.push.model.Message;
import cn.jpush.api.push.model.Options;
import cn.jpush.api.push.model.Platform;
import cn.jpush.api.push.model.PushPayload;
import cn.jpush.api.push.model.audience.Audience;
import cn.jpush.api.push.model.notification.AndroidNotification;
import cn.jpush.api.push.model.notification.IosNotification;
import cn.jpush.api.push.model.notification.Notification;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
 
import java.util.List;
 
/**
 * 極光推送客戶端
 *
 * @author Mengday Zhang
 * @version 1.0
 * @since 2019-04-01
 */
@Component
public class MyJPushClient {
    @Value("${jpush.appKey}")
    private String appKey;
 
    @Value("${jpush.masterSecret}")
    private String masterSecret;
 
    @Value("${jpush.apnsProduction}")
    private boolean apnsProduction;
 
    private static JPushClient jPushClient = null;
    private static final int RESPONSE_OK = 200;
    private static final Logger logger = LoggerFactory.getLogger(MyJPushClient.class);
 
 
    public JPushClient getJPushClient() {
        if (jPushClient == null) {
            jPushClient = new JPushClient(masterSecret, appKey);
        }
 
        return jPushClient;
    }
 
 
    /**
     * 推送到alias列表
     *
     * @param alias             別名或別名組
     * @param notificationTitle 通知內(nèi)容標題
     * @param msgTitle          消息內(nèi)容標題
     * @param msgContent        消息內(nèi)容
     * @param extras            擴展字段
     */
    public void sendToAliasList(List<String> alias, String notificationTitle, String msgTitle, String msgContent, String extras) {
        PushPayload pushPayload = buildPushObject_all_aliasList_alertWithTitle(alias, notificationTitle, msgTitle, msgContent, extras);
        this.sendPush(pushPayload);
    }
 
    /**
     * 推送到tag列表
     *
     * @param tagsList          Tag或Tag組
     * @param notificationTitle 通知內(nèi)容標題
     * @param msgTitle          消息內(nèi)容標題
     * @param msgContent        消息內(nèi)容
     * @param extras            擴展字段
     */
    public void sendToTagsList(List<String> tagsList, String notificationTitle, String msgTitle, String msgContent, String extras) {
        PushPayload pushPayload = buildPushObject_all_tagList_alertWithTitle(tagsList, notificationTitle, msgTitle, msgContent, extras);
        this.sendPush(pushPayload);
    }
 
    /**
     * 發(fā)送給所有安卓用戶
     *
     * @param notificationTitle 通知內(nèi)容標題
     * @param msgTitle          消息內(nèi)容標題
     * @param msgContent        消息內(nèi)容
     * @param extras        擴展字段
     */
    public void sendToAllAndroid(String notificationTitle, String msgTitle, String msgContent, String extras) {
        PushPayload pushPayload = buildPushObject_android_all_alertWithTitle(notificationTitle, msgTitle, msgContent, extras);
        this.sendPush(pushPayload);
    }
 
    /**
     * 發(fā)送給所有IOS用戶
     *
     * @param notificationTitle 通知內(nèi)容標題
     * @param msgTitle          消息內(nèi)容標題
     * @param msgContent        消息內(nèi)容
     * @param extras        擴展字段
     */
    public void sendToAllIOS(String notificationTitle, String msgTitle, String msgContent, String extras) {
        PushPayload pushPayload = buildPushObject_ios_all_alertWithTitle(notificationTitle, msgTitle, msgContent, extras);
        this.sendPush(pushPayload);
    }
 
    /**
     * 發(fā)送給所有用戶
     *
     * @param notificationTitle 通知內(nèi)容標題
     * @param msgTitle          消息內(nèi)容標題
     * @param msgContent        消息內(nèi)容
     * @param extras        擴展字段
     */
    public void sendToAll(String notificationTitle, String msgTitle, String msgContent, String extras) {
        PushPayload pushPayload = buildPushObject_android_and_ios(notificationTitle, msgTitle, msgContent, extras);
        this.sendPush(pushPayload);
    }
 
    private PushResult sendPush(PushPayload pushPayload) {
        logger.info("pushPayload={}", pushPayload);
        PushResult pushResult = null;
        try {
            pushResult = this.getJPushClient().sendPush(pushPayload);
            logger.info("" + pushResult);
            if (pushResult.getResponseCode() == RESPONSE_OK) {
                logger.info("push successful, pushPayload={}", pushPayload);
            }
        } catch (APIConnectionException e) {
            logger.error("push failed: pushPayload={}, exception={}", pushPayload, e);
        } catch (APIRequestException e) {
            logger.error("push failed: pushPayload={}, exception={}", pushPayload, e);
        }
 
        return pushResult;
    }
 
 
    /**
     * 向所有平臺所有用戶推送消息
     *
     * @param notificationTitle
     * @param msgTitle
     * @param msgContent
     * @param extras
     * @return
     */
    public PushPayload buildPushObject_android_and_ios(String notificationTitle, String msgTitle, String msgContent, String extras) {
        return PushPayload.newBuilder()
                .setPlatform(Platform.android_ios())
                .setAudience(Audience.all())
                .setNotification(Notification.newBuilder()
                        .setAlert(notificationTitle)
                        .addPlatformNotification(AndroidNotification.newBuilder()
                                .setAlert(notificationTitle)
                                .setTitle(notificationTitle)
                                // 此字段為透傳字段,不會顯示在通知欄。用戶可以通過此字段來做一些定制需求,如特定的key傳要指定跳轉(zhuǎn)的頁面(value)
                                .addExtra("androidNotification extras key", extras)
                                .build()
                        )
                        .addPlatformNotification(IosNotification.newBuilder()
                                // 傳一個IosAlert對象,指定apns title、title、subtitle等
                                .setAlert(notificationTitle)
                                // 直接傳alert
                                // 此項是指定此推送的badge自動加1
                                .incrBadge(1)
                                // 此字段的值default表示系統(tǒng)默認聲音;傳sound.caf表示此推送以項目里面打包的sound.caf聲音來提醒,
                                // 如果系統(tǒng)沒有此音頻則以系統(tǒng)默認聲音提醒;此字段如果傳空字符串,iOS9及以上的系統(tǒng)是無聲音提醒,以下的系統(tǒng)是默認聲音
                                .setSound("default")
                                // 此字段為透傳字段,不會顯示在通知欄。用戶可以通過此字段來做一些定制需求,如特定的key傳要指定跳轉(zhuǎn)的頁面(value)
                                .addExtra("iosNotification extras key", extras)
                                // 此項說明此推送是一個background推送,想了解background看:http://docs.jpush.io/client/ios_tutorials/#ios-7-background-remote-notification
                                // .setContentAvailable(true)
                                .build()
                        )
                        .build()
                )
                // Platform指定了哪些平臺就會像指定平臺中符合推送條件的設(shè)備進行推送。jpush的自定義消息,
                // sdk默認不做任何處理,不會有通知提示。建議看文檔http://docs.jpush.io/guideline/faq/的
                // [通知與自定義消息有什么區(qū)別?]了解通知和自定義消息的區(qū)別
                .setMessage(Message.newBuilder()
                        .setMsgContent(msgContent)
                        .setTitle(msgTitle)
                        .addExtra("message extras key", extras)
                        .build())
                .setOptions(Options.newBuilder()
                        // 此字段的值是用來指定本推送要推送的apns環(huán)境,false表示開發(fā),true表示生產(chǎn);對android和自定義消息無意義
                        .setApnsProduction(apnsProduction)
                        // 此字段是給開發(fā)者自己給推送編號,方便推送者分辨推送記錄
                        .setSendno(1)
                        // 此字段的值是用來指定本推送的離線保存時長,如果不傳此字段則默認保存一天,最多指定保留十天,單位為秒
                        .setTimeToLive(86400)
                        .build())
                .build();
    }
 
 
    /**
     * 向所有平臺單個或多個指定別名用戶推送消息
     *
     * @param aliasList
     * @param notificationTitle
     * @param msgTitle
     * @param msgContent
     * @param extras
     * @return
     */
    private PushPayload buildPushObject_all_aliasList_alertWithTitle(List<String> aliasList, String notificationTitle, String msgTitle, String msgContent, String extras) {
        // 創(chuàng)建一個IosAlert對象,可指定APNs的alert、title等字段
        // IosAlert iosAlert =  IosAlert.newBuilder().setTitleAndBody("title", "alert body").build();
 
        return PushPayload.newBuilder()
                // 指定要推送的平臺,all代表當(dāng)前應(yīng)用配置了的所有平臺,也可以傳android等具體平臺
                .setPlatform(Platform.all())
                // 指定推送的接收對象,all代表所有人,也可以指定已經(jīng)設(shè)置成功的tag或alias或該應(yīng)應(yīng)用客戶端調(diào)用接口獲取到的registration id
                .setAudience(Audience.alias(aliasList))
                // jpush的通知,android的由jpush直接下發(fā),iOS的由apns服務(wù)器下發(fā),Winphone的由mpns下發(fā)
                .setNotification(Notification.newBuilder()
                        // 指定當(dāng)前推送的android通知
                        .addPlatformNotification(AndroidNotification.newBuilder()
                                .setAlert(notificationTitle)
                                .setTitle(notificationTitle)
                                // 此字段為透傳字段,不會顯示在通知欄。用戶可以通過此字段來做一些定制需求,如特定的key傳要指定跳轉(zhuǎn)的頁面(value)
                                .addExtra("androidNotification extras key", extras)
                                .build())
                        // 指定當(dāng)前推送的iOS通知
                        .addPlatformNotification(IosNotification.newBuilder()
                                // 傳一個IosAlert對象,指定apns title、title、subtitle等
                                .setAlert(notificationTitle)
                                // 直接傳alert
                                // 此項是指定此推送的badge自動加1
                                .incrBadge(1)
                                // 此字段的值default表示系統(tǒng)默認聲音;傳sound.caf表示此推送以項目里面打包的sound.caf聲音來提醒,
                                // 如果系統(tǒng)沒有此音頻則以系統(tǒng)默認聲音提醒;此字段如果傳空字符串,iOS9及以上的系統(tǒng)是無聲音提醒,以下的系統(tǒng)是默認聲音
                                .setSound("default")
                                // 此字段為透傳字段,不會顯示在通知欄。用戶可以通過此字段來做一些定制需求,如特定的key傳要指定跳轉(zhuǎn)的頁面(value)
                                .addExtra("iosNotification extras key", extras)
                                // 此項說明此推送是一個background推送,想了解background看:http://docs.jpush.io/client/ios_tutorials/#ios-7-background-remote-notification
                                // 取消此注釋,消息推送時ios將無法在鎖屏情況接收
                                // .setContentAvailable(true)
                                .build())
                        .build())
                // Platform指定了哪些平臺就會像指定平臺中符合推送條件的設(shè)備進行推送。jpush的自定義消息,
                // sdk默認不做任何處理,不會有通知提示。建議看文檔http://docs.jpush.io/guideline/faq/的
                // [通知與自定義消息有什么區(qū)別?]了解通知和自定義消息的區(qū)別
                .setMessage(Message.newBuilder()
                        .setMsgContent(msgContent)
                        .setTitle(msgTitle)
                        .addExtra("message extras key", extras)
                        .build())
                .setOptions(Options.newBuilder()
                        // 此字段的值是用來指定本推送要推送的apns環(huán)境,false表示開發(fā),true表示生產(chǎn);對android和自定義消息無意義
                        .setApnsProduction(apnsProduction)
                        // 此字段是給開發(fā)者自己給推送編號,方便推送者分辨推送記錄
                        .setSendno(1)
                        // 此字段的值是用來指定本推送的離線保存時長,如果不傳此字段則默認保存一天,最多指定保留十天;
                        .setTimeToLive(86400)
                        .build())
                .build();
 
    }
 
    /**
     * 向所有平臺單個或多個指定Tag用戶推送消息
     *
     * @param tagsList
     * @param notificationTitle
     * @param msgTitle
     * @param msgContent
     * @param extras
     * @return
     */
    private PushPayload buildPushObject_all_tagList_alertWithTitle(List<String> tagsList, String notificationTitle, String msgTitle, String msgContent, String extras) {
        //創(chuàng)建一個IosAlert對象,可指定APNs的alert、title等字段
        //IosAlert iosAlert =  IosAlert.newBuilder().setTitleAndBody("title", "alert body").build();
 
        return PushPayload.newBuilder()
                // 指定要推送的平臺,all代表當(dāng)前應(yīng)用配置了的所有平臺,也可以傳android等具體平臺
                .setPlatform(Platform.all())
                // 指定推送的接收對象,all代表所有人,也可以指定已經(jīng)設(shè)置成功的tag或alias或該應(yīng)應(yīng)用客戶端調(diào)用接口獲取到的registration id
                .setAudience(Audience.tag(tagsList))
                // jpush的通知,android的由jpush直接下發(fā),iOS的由apns服務(wù)器下發(fā),Winphone的由mpns下發(fā)
                .setNotification(Notification.newBuilder()
                        // 指定當(dāng)前推送的android通知
                        .addPlatformNotification(AndroidNotification.newBuilder()
                                .setAlert(notificationTitle)
                                .setTitle(notificationTitle)
                                //此字段為透傳字段,不會顯示在通知欄。用戶可以通過此字段來做一些定制需求,如特定的key傳要指定跳轉(zhuǎn)的頁面(value)
                                .addExtra("androidNotification extras key", extras)
                                .build())
                        // 指定當(dāng)前推送的iOS通知
                        .addPlatformNotification(IosNotification.newBuilder()
                                // 傳一個IosAlert對象,指定apns title、title、subtitle等
                                .setAlert(notificationTitle)
                                // 直接傳alert
                                // 此項是指定此推送的badge自動加1
                                .incrBadge(1)
                                // 此字段的值default表示系統(tǒng)默認聲音;傳sound.caf表示此推送以項目里面打包的sound.caf聲音來提醒,
                                // 如果系統(tǒng)沒有此音頻則以系統(tǒng)默認聲音提醒;此字段如果傳空字符串,iOS9及以上的系統(tǒng)是無聲音提醒,以下的系統(tǒng)是默認聲音
                                .setSound("default")
                                // 此字段為透傳字段,不會顯示在通知欄。用戶可以通過此字段來做一些定制需求,如特定的key傳要指定跳轉(zhuǎn)的頁面(value)
                                .addExtra("iosNotification extras key", extras)
                                // 此項說明此推送是一個background推送,想了解background看:http://docs.jpush.io/client/ios_tutorials/#ios-7-background-remote-notification
                                // 取消此注釋,消息推送時ios將無法在鎖屏情況接收
                                // .setContentAvailable(true)
                                .build())
                        .build())
                // Platform指定了哪些平臺就會像指定平臺中符合推送條件的設(shè)備進行推送。jpush的自定義消息,
                // sdk默認不做任何處理,不會有通知提示。建議看文檔http://docs.jpush.io/guideline/faq/的
                // [通知與自定義消息有什么區(qū)別?]了解通知和自定義消息的區(qū)別
                .setMessage(Message.newBuilder()
                        .setMsgContent(msgContent)
                        .setTitle(msgTitle)
                        .addExtra("message extras key", extras)
                        .build())
                .setOptions(Options.newBuilder()
                        // 此字段的值是用來指定本推送要推送的apns環(huán)境,false表示開發(fā),true表示生產(chǎn);對android和自定義消息無意義
                        .setApnsProduction(apnsProduction)
                        // 此字段是給開發(fā)者自己給推送編號,方便推送者分辨推送記錄
                        .setSendno(1)
                        // 此字段的值是用來指定本推送的離線保存時長,如果不傳此字段則默認保存一天,最多指定保留十天;
                        .setTimeToLive(86400)
                        .build())
                .build();
 
    }
 
 
    /**
     * 向android平臺所有用戶推送消息
     *
     * @param notificationTitle
     * @param msgTitle
     * @param msgContent
     * @param extras
     * @return
     */
    private PushPayload buildPushObject_android_all_alertWithTitle(String notificationTitle, String msgTitle, String msgContent, String extras) {
        return PushPayload.newBuilder()
                // 指定要推送的平臺,all代表當(dāng)前應(yīng)用配置了的所有平臺,也可以傳android等具體平臺
                .setPlatform(Platform.android())
                // 指定推送的接收對象,all代表所有人,也可以指定已經(jīng)設(shè)置成功的tag或alias或該應(yīng)應(yīng)用客戶端調(diào)用接口獲取到的registration id
                .setAudience(Audience.all())
                // jpush的通知,android的由jpush直接下發(fā),iOS的由apns服務(wù)器下發(fā),Winphone的由mpns下發(fā)
                .setNotification(Notification.newBuilder()
                        // 指定當(dāng)前推送的android通知
                        .addPlatformNotification(AndroidNotification.newBuilder()
                                .setAlert(notificationTitle)
                                .setTitle(notificationTitle)
                                // 此字段為透傳字段,不會顯示在通知欄。用戶可以通過此字段來做一些定制需求,如特定的key傳要指定跳轉(zhuǎn)的頁面(value)
                                .addExtra("androidNotification extras key", extras)
                                .build())
                        .build()
                )
                // Platform指定了哪些平臺就會像指定平臺中符合推送條件的設(shè)備進行推送。jpush的自定義消息,
                // sdk默認不做任何處理,不會有通知提示。建議看文檔http://docs.jpush.io/guideline/faq/的
                // [通知與自定義消息有什么區(qū)別?]了解通知和自定義消息的區(qū)別
                .setMessage(Message.newBuilder()
                        .setMsgContent(msgContent)
                        .setTitle(msgTitle)
                        .addExtra("message extras key", extras)
                        .build())
 
                .setOptions(Options.newBuilder()
                        // 此字段的值是用來指定本推送要推送的apns環(huán)境,false表示開發(fā),true表示生產(chǎn);對android和自定義消息無意義
                        .setApnsProduction(apnsProduction)
                        // 此字段是給開發(fā)者自己給推送編號,方便推送者分辨推送記錄
                        .setSendno(1)
                        // 此字段的值是用來指定本推送的離線保存時長,如果不傳此字段則默認保存一天,最多指定保留十天,單位為秒
                        .setTimeToLive(86400)
                        .build())
                .build();
    }
 
 
    /**
     * 向ios平臺所有用戶推送消息
     *
     * @param notificationTitle
     * @param msgTitle
     * @param msgContent
     * @param extras
     * @return
     */
    private PushPayload buildPushObject_ios_all_alertWithTitle(String notificationTitle, String msgTitle, String msgContent, String extras) {
        return PushPayload.newBuilder()
                // 指定要推送的平臺,all代表當(dāng)前應(yīng)用配置了的所有平臺,也可以傳android等具體平臺
                .setPlatform(Platform.ios())
                // 指定推送的接收對象,all代表所有人,也可以指定已經(jīng)設(shè)置成功的tag或alias或該應(yīng)應(yīng)用客戶端調(diào)用接口獲取到的registration id
                .setAudience(Audience.all())
                // jpush的通知,android的由jpush直接下發(fā),iOS的由apns服務(wù)器下發(fā),Winphone的由mpns下發(fā)
                .setNotification(Notification.newBuilder()
                        // 指定當(dāng)前推送的android通知
                        .addPlatformNotification(IosNotification.newBuilder()
                                // 傳一個IosAlert對象,指定apns title、title、subtitle等
                                .setAlert(notificationTitle)
                                // 直接傳alert
                                // 此項是指定此推送的badge自動加1
                                .incrBadge(1)
                                // 此字段的值default表示系統(tǒng)默認聲音;傳sound.caf表示此推送以項目里面打包的sound.caf聲音來提醒,
                                // 如果系統(tǒng)沒有此音頻則以系統(tǒng)默認聲音提醒;此字段如果傳空字符串,iOS9及以上的系統(tǒng)是無聲音提醒,以下的系統(tǒng)是默認聲音
                                .setSound("default")
                                // 此字段為透傳字段,不會顯示在通知欄。用戶可以通過此字段來做一些定制需求,如特定的key傳要指定跳轉(zhuǎn)的頁面(value)
                                .addExtra("iosNotification extras key", extras)
                                // 此項說明此推送是一個background推送,想了解background看:http://docs.jpush.io/client/ios_tutorials/#ios-7-background-remote-notification
                                // .setContentAvailable(true)
                                .build())
                        .build()
                )
                // Platform指定了哪些平臺就會像指定平臺中符合推送條件的設(shè)備進行推送。jpush的自定義消息,
                // sdk默認不做任何處理,不會有通知提示。建議看文檔http://docs.jpush.io/guideline/faq/的
                // [通知與自定義消息有什么區(qū)別?]了解通知和自定義消息的區(qū)別
                .setMessage(Message.newBuilder()
                        .setMsgContent(msgContent)
                        .setTitle(msgTitle)
                        .addExtra("message extras key", extras)
                        .build())
                .setOptions(Options.newBuilder()
                        // 此字段的值是用來指定本推送要推送的apns環(huán)境,false表示開發(fā),true表示生產(chǎn);對android和自定義消息無意義
                        .setApnsProduction(apnsProduction)
                        // 此字段是給開發(fā)者自己給推送編號,方便推送者分辨推送記錄
                        .setSendno(1)
                        // 此字段的值是用來指定本推送的離線保存時長,如果不傳此字段則默認保存一天,最多指定保留十天,單位為秒
                        .setTimeToLive(86400)
                        .build())
                .build();
    }
 
    public static void main(String[] args) {
//        MyJPushClient jPushUtil = new MyJPushClient();
//        List<String> aliasList = Arrays.asList("239");
//        String notificationTitle = "notificationTitle";
//        String msgTitle = "msgTitle";
//        String msgContent = "msgContent";
//        jPushUtil.sendToAliasList(aliasList, notificationTitle, msgTitle, msgContent, "exts");
    }
 
}

4.test

@RunWith(SpringRunner.class)
@SpringBootTest
public class JPushApplicationTests {
 
    @Autowired
    private MyJPushClient jPushClient;
 
    @Test
    public void testJPush() {
        List<String> aliasList = Arrays.asList("239");
        String notificationTitle = "notification_title";
        String msgTitle = "msg_title";
        String msgContent = "msg_content";
        jPushClient.sendToAliasList(aliasList, notificationTitle, msgTitle, msgContent, "exts");
    }
}

到此這篇關(guān)于SpringBoot集成極光推送完整實現(xiàn)代碼的文章就介紹到這了,更多相關(guān)SpringBoot集成極光推送內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • MyBatis在DAO層定義接口返回類型泛型無效的解決

    MyBatis在DAO層定義接口返回類型泛型無效的解決

    這篇文章主要介紹了MyBatis在DAO層定義接口返回類型泛型無效的解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-07-07
  • elasticsearch設(shè)置賬號和密碼的完整代碼示例

    elasticsearch設(shè)置賬號和密碼的完整代碼示例

    這篇文章主要介紹了如何在Docker中安裝和配置Elasticsearch(ES)和Kibana,描述了如何設(shè)置Kibana的用戶和密碼,并解決由于ES默認禁止使用超級用戶登錄Kibana的問題,需要的朋友可以參考下
    2025-01-01
  • Java字節(jié)碼中jvm實例用法

    Java字節(jié)碼中jvm實例用法

    在本篇文章里小編給大家整理的是一篇關(guān)于Java字節(jié)碼中jvm實例用法內(nèi)容,有興趣的朋友們可以學(xué)習(xí)參考下。
    2021-02-02
  • springboot?整合?clickhouse的實現(xiàn)示例

    springboot?整合?clickhouse的實現(xiàn)示例

    本文主要介紹了springboot?整合?clickhouse的實現(xiàn)示例,文中通過示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-02-02
  • Java使用POI實現(xiàn)excel文件的導(dǎo)入和導(dǎo)出

    Java使用POI實現(xiàn)excel文件的導(dǎo)入和導(dǎo)出

    這篇文章主要為大家詳細介紹了Java如何使用POI實現(xiàn)excel文件的導(dǎo)入和導(dǎo)出功能,文中的示例代碼講解詳細,感興趣的小伙伴可以跟隨小編一起學(xué)習(xí)一下
    2023-12-12
  • 解決java錯誤:不支持發(fā)行版本5

    解決java錯誤:不支持發(fā)行版本5

    這篇文章主要給大家介紹了關(guān)于如何解決java錯誤:不支持發(fā)行版本5的相關(guān)資料,發(fā)行版本5是Java5,已經(jīng)是十多年前的版本了,現(xiàn)在已經(jīng)不再被支持,需要的朋友可以參考下
    2023-07-07
  • java 反射機制

    java 反射機制

    本文主要介紹了java反射機制的相關(guān)知識,具有一定的參考價值,下面跟著小編一起來看下吧
    2017-02-02
  • Spring中的EventListenerMethodProcessor組件詳解

    Spring中的EventListenerMethodProcessor組件詳解

    這篇文章主要介紹了Spring中的EventListenerMethodProcessor組件詳解,EventListenerMethodProcessor 是 Spring 事件機制中非常重要的一個組件,它管理了一組EventListenerFactory組件,用來將應(yīng)用中每個使用@EventListener注解定義的事件監(jiān)聽,需要的朋友可以參考下
    2023-12-12
  • 日志模塊自定義@SkipLogAspect注解跳過切面的操作方法

    日志模塊自定義@SkipLogAspect注解跳過切面的操作方法

    文章介紹了一個自定義注解@SkipLogAspect,用于在日志模塊中跳過特定方法的日志切面,這個注解可以用于需要避免大對象轉(zhuǎn)換為JSON時導(dǎo)致的OOM問題,文章還提供了注解的實現(xiàn)代碼以及一個測試示例,展示了如何在控制器中使用該注解來跳過日志切面,感興趣的朋友一起看看吧
    2025-02-02
  • MyBatis詳細講解DAO代理的使用

    MyBatis詳細講解DAO代理的使用

    MyBatis允許只聲明一個dao接口,而無需寫dao實現(xiàn)類的方式實現(xiàn)數(shù)據(jù)庫操作。前提是必須保證Mapper文件中的<mapper>標簽的namespace屬性值必須要和dao接口的類路徑一致,MyBatis容器會自動通過動態(tài)代理生成接口的實現(xiàn)類
    2022-04-04

最新評論

绵竹市| 确山县| 布尔津县| 虹口区| 林州市| 鸡泽县| 秭归县| 株洲市| 江安县| 望城县| 睢宁县| 岱山县| 兖州市| 信丰县| 宜黄县| 斗六市| 东乌| 乐东| 阿瓦提县| 化德县| 庄浪县| 临泽县| 天峻县| 精河县| 遂宁市| 博乐市| 济南市| 沾益县| 睢宁县| 淄博市| 施甸县| 搜索| 柳江县| 法库县| 金坛市| 济南市| 宜州市| 杭锦旗| 樟树市| 富裕县| 新丰县|