乾貨|SpringBoot集成極光推送Java-SDK(建議收藏)

2020-12-17 Java實用技術

工作中經常會遇到伺服器向App推送消息的需求,一般企業中選擇用極光推送的比較多,在集成極光時發現極光的文檔並不完整,網上的文章也很多不能直接使用,這裡列出我在工作中集成極光的全部代碼,只需要按照如下代碼保證一次性實現。

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 # 是否生成環境,true表示生成環境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 */@Componentpublic 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 通知內容標題 * @param msgTitle 消息內容標題 * @param msgContent 消息內容 * @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 通知內容標題 * @param msgTitle 消息內容標題 * @param msgContent 消息內容 * @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); } /** * 發送給所有安卓用戶 * * @param notificationTitle 通知內容標題 * @param msgTitle 消息內容標題 * @param msgContent 消息內容 * @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); } /** * 發送給所有IOS用戶 * * @param notificationTitle 通知內容標題 * @param msgTitle 消息內容標題 * @param msgContent 消息內容 * @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); } /** * 發送給所有用戶 * * @param notificationTitle 通知內容標題 * @param msgTitle 消息內容標題 * @param msgContent 消息內容 * @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傳要指定跳轉的頁面(value) .addExtra("androidNotification extras key", extras) .build() ) .addPlatformNotification(IosNotification.newBuilder() // 傳一個IosAlert對象,指定apns title、title、subtitle等 .setAlert(notificationTitle) // 直接傳alert // 此項是指定此推送的badge自動加1 .incrBadge(1) // 此欄位的值default表示系統默認聲音;傳sound.caf表示此推送以項目裡面打包的sound.caf聲音來提醒, // 如果系統沒有此音頻則以系統默認聲音提醒;此欄位如果傳空字符串,iOS9及以上的系統是無聲音提醒,以下的系統是默認聲音 .setSound("default") // 此欄位為透傳欄位,不會顯示在通知欄。用戶可以通過此欄位來做一些定製需求,如特定的key傳要指定跳轉的頁面(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指定了哪些平臺就會像指定平臺中符合推送條件的設備進行推送。 jpush的自定義消息, // sdk默認不做任何處理,不會有通知提示。建議看文檔http://docs.jpush.io/guideline/faq/的 // [通知與自定義消息有什麼區別?]了解通知和自定義消息的區別 .setMessage(Message.newBuilder() .setMsgContent(msgContent) .setTitle(msgTitle) .addExtra("message extras key", extras) .build()) .setOptions(Options.newBuilder() // 此欄位的值是用來指定本推送要推送的apns環境,false表示開發,true表示生產;對android和自定義消息無意義 .setApnsProduction(apnsProduction) // 此欄位是給開發者自己給推送編號,方便推送者分辨推送記錄 .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) { // 創建一個IosAlert對象,可指定APNs的alert、title等欄位 // IosAlert iosAlert = IosAlert.newBuilder().setTitleAndBody("title", "alert body").build(); return PushPayload.newBuilder() // 指定要推送的平臺,all代表當前應用配置了的所有平臺,也可以傳android等具體平臺 .setPlatform(Platform.all()) // 指定推送的接收對象,all代表所有人,也可以指定已經設置成功的tag或alias或該應應用客戶端調用接口獲取到的registration id .setAudience(Audience.alias(aliasList)) // jpush的通知,android的由jpush直接下發,iOS的由apns伺服器下發,Winphone的由mpns下發 .setNotification(Notification.newBuilder() // 指定當前推送的android通知 .addPlatformNotification(AndroidNotification.newBuilder() .setAlert(notificationTitle) .setTitle(notificationTitle) // 此欄位為透傳欄位,不會顯示在通知欄。用戶可以通過此欄位來做一些定製需求,如特定的key傳要指定跳轉的頁面(value) .addExtra("androidNotification extras key", extras) .build()) // 指定當前推送的iOS通知 .addPlatformNotification(IosNotification.newBuilder() // 傳一個IosAlert對象,指定apns title、title、subtitle等 .setAlert(notificationTitle) // 直接傳alert // 此項是指定此推送的badge自動加1 .incrBadge(1) // 此欄位的值default表示系統默認聲音;傳sound.caf表示此推送以項目裡面打包的sound.caf聲音來提醒, // 如果系統沒有此音頻則以系統默認聲音提醒;此欄位如果傳空字符串,iOS9及以上的系統是無聲音提醒,以下的系統是默認聲音 .setSound("default") // 此欄位為透傳欄位,不會顯示在通知欄。用戶可以通過此欄位來做一些定製需求,如特定的key傳要指定跳轉的頁面(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指定了哪些平臺就會像指定平臺中符合推送條件的設備進行推送。 jpush的自定義消息, // sdk默認不做任何處理,不會有通知提示。建議看文檔http://docs.jpush.io/guideline/faq/的 // [通知與自定義消息有什麼區別?]了解通知和自定義消息的區別 .setMessage(Message.newBuilder() .setMsgContent(msgContent) .setTitle(msgTitle) .addExtra("message extras key", extras) .build()) .setOptions(Options.newBuilder() // 此欄位的值是用來指定本推送要推送的apns環境,false表示開發,true表示生產;對android和自定義消息無意義 .setApnsProduction(apnsProduction) // 此欄位是給開發者自己給推送編號,方便推送者分辨推送記錄 .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) { //創建一個IosAlert對象,可指定APNs的alert、title等欄位 //IosAlert iosAlert = IosAlert.newBuilder().setTitleAndBody("title", "alert body").build(); return PushPayload.newBuilder() // 指定要推送的平臺,all代表當前應用配置了的所有平臺,也可以傳android等具體平臺 .setPlatform(Platform.all()) // 指定推送的接收對象,all代表所有人,也可以指定已經設置成功的tag或alias或該應應用客戶端調用接口獲取到的registration id .setAudience(Audience.tag(tagsList)) // jpush的通知,android的由jpush直接下發,iOS的由apns伺服器下發,Winphone的由mpns下發 .setNotification(Notification.newBuilder() // 指定當前推送的android通知 .addPlatformNotification(AndroidNotification.newBuilder() .setAlert(notificationTitle) .setTitle(notificationTitle) //此欄位為透傳欄位,不會顯示在通知欄。用戶可以通過此欄位來做一些定製需求,如特定的key傳要指定跳轉的頁面(value) .addExtra("androidNotification extras key", extras) .build()) // 指定當前推送的iOS通知 .addPlatformNotification(IosNotification.newBuilder() // 傳一個IosAlert對象,指定apns title、title、subtitle等 .setAlert(notificationTitle) // 直接傳alert // 此項是指定此推送的badge自動加1 .incrBadge(1) // 此欄位的值default表示系統默認聲音;傳sound.caf表示此推送以項目裡面打包的sound.caf聲音來提醒, // 如果系統沒有此音頻則以系統默認聲音提醒;此欄位如果傳空字符串,iOS9及以上的系統是無聲音提醒,以下的系統是默認聲音 .setSound("default") // 此欄位為透傳欄位,不會顯示在通知欄。用戶可以通過此欄位來做一些定製需求,如特定的key傳要指定跳轉的頁面(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指定了哪些平臺就會像指定平臺中符合推送條件的設備進行推送。 jpush的自定義消息, // sdk默認不做任何處理,不會有通知提示。建議看文檔http://docs.jpush.io/guideline/faq/的 // [通知與自定義消息有什麼區別?]了解通知和自定義消息的區別 .setMessage(Message.newBuilder() .setMsgContent(msgContent) .setTitle(msgTitle) .addExtra("message extras key", extras) .build()) .setOptions(Options.newBuilder() // 此欄位的值是用來指定本推送要推送的apns環境,false表示開發,true表示生產;對android和自定義消息無意義 .setApnsProduction(apnsProduction) // 此欄位是給開發者自己給推送編號,方便推送者分辨推送記錄 .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代表當前應用配置了的所有平臺,也可以傳android等具體平臺 .setPlatform(Platform.android()) // 指定推送的接收對象,all代表所有人,也可以指定已經設置成功的tag或alias或該應應用客戶端調用接口獲取到的registration id .setAudience(Audience.all()) // jpush的通知,android的由jpush直接下發,iOS的由apns伺服器下發,Winphone的由mpns下發 .setNotification(Notification.newBuilder() // 指定當前推送的android通知 .addPlatformNotification(AndroidNotification.newBuilder() .setAlert(notificationTitle) .setTitle(notificationTitle) // 此欄位為透傳欄位,不會顯示在通知欄。用戶可以通過此欄位來做一些定製需求,如特定的key傳要指定跳轉的頁面(value) .addExtra("androidNotification extras key", extras) .build()) .build() ) // Platform指定了哪些平臺就會像指定平臺中符合推送條件的設備進行推送。 jpush的自定義消息, // sdk默認不做任何處理,不會有通知提示。建議看文檔http://docs.jpush.io/guideline/faq/的 // [通知與自定義消息有什麼區別?]了解通知和自定義消息的區別 .setMessage(Message.newBuilder() .setMsgContent(msgContent) .setTitle(msgTitle) .addExtra("message extras key", extras) .build()) .setOptions(Options.newBuilder() // 此欄位的值是用來指定本推送要推送的apns環境,false表示開發,true表示生產;對android和自定義消息無意義 .setApnsProduction(apnsProduction) // 此欄位是給開發者自己給推送編號,方便推送者分辨推送記錄 .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代表當前應用配置了的所有平臺,也可以傳android等具體平臺 .setPlatform(Platform.ios()) // 指定推送的接收對象,all代表所有人,也可以指定已經設置成功的tag或alias或該應應用客戶端調用接口獲取到的registration id .setAudience(Audience.all()) // jpush的通知,android的由jpush直接下發,iOS的由apns伺服器下發,Winphone的由mpns下發 .setNotification(Notification.newBuilder() // 指定當前推送的android通知 .addPlatformNotification(IosNotification.newBuilder() // 傳一個IosAlert對象,指定apns title、title、subtitle等 .setAlert(notificationTitle) // 直接傳alert // 此項是指定此推送的badge自動加1 .incrBadge(1) // 此欄位的值default表示系統默認聲音;傳sound.caf表示此推送以項目裡面打包的sound.caf聲音來提醒, // 如果系統沒有此音頻則以系統默認聲音提醒;此欄位如果傳空字符串,iOS9及以上的系統是無聲音提醒,以下的系統是默認聲音 .setSound("default") // 此欄位為透傳欄位,不會顯示在通知欄。用戶可以通過此欄位來做一些定製需求,如特定的key傳要指定跳轉的頁面(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指定了哪些平臺就會像指定平臺中符合推送條件的設備進行推送。 jpush的自定義消息, // sdk默認不做任何處理,不會有通知提示。建議看文檔http://docs.jpush.io/guideline/faq/的 // [通知與自定義消息有什麼區別?]了解通知和自定義消息的區別 .setMessage(Message.newBuilder() .setMsgContent(msgContent) .setTitle(msgTitle) .addExtra("message extras key", extras) .build()) .setOptions(Options.newBuilder() // 此欄位的值是用來指定本推送要推送的apns環境,false表示開發,true表示生產;對android和自定義消息無意義 .setApnsProduction(apnsProduction) // 此欄位是給開發者自己給推送編號,方便推送者分辨推送記錄 .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)@SpringBootTestpublic 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"); }}

獲取示例源碼請轉發該文章並關注Java實用技術,私信獲取極光推送源碼。

相關焦點

  • pacebox-springboot 1.1.5 發布,java 生態框架
    pacebox-springboot 融合封裝已發布,旨在提供快速開發腳手架、打造更好的開源生態環境。
  • 全網最細緻的SpringBoot實戰教程,超適合新手小白入坑學習
    約定大於配置Spring Boot 的底層用的就是Spring訪問官網:spring.io 再點擊projects1.背景問題J2EE笨重的開發,繁多的配置、低下的開發效率、複雜的部署流程,第三發技術集成難度大
  • springboot的jar為何能獨立運行
    能獨立運行的jar文件在開發springboot應用時,通過java -jar命令啟動應用是常用的方式,今天就來一起了解這個簡單操作背後的技術;開發demo開發一個springboot應用作為本次研究的對象,對應的版本信息如下:
  • Springboot+MybatisPlus高效實現增刪改查
    </artifactId><scope>runtime</scope></dependency></dependencies>springboot的依賴:提供了使用springboot
  • 騰訊T7架構師至今還在鑽研的SpringBoot從構建小系統到架構大系統
    前言個人認為,springboot是隨著Spring4.0出生的, 他的出現,目的是為了解決Spring這麼多年來的發展導致本身的笨重、各類繁瑣及與第三方框架整合的配置文件,對於碼農或項目團隊來說,是不希望見到的。因此springboot的出現是為了解決spring多年發展帶來的弊端。
  • Go+iris吊打Java+SpringBoot,是Java老了嗎?且慢,Vert.x有話說
    Go+Iris vs Java+SpringBoot 為您揭曉答案那個結果很容易給人一個錯覺:是java老了嗎?當然不是!Java界的性能擔當根本就不是Spring,只是因為國內用java的web框架主要是Spring,我們才拿它來測……本次我們就請出java界的性能擔當——Vert.x,跟Iris再比一次這次的結果會比較有說服力因為iris在官網自稱自己是
  • springboot+springsecurity實現前後端分離簡單實現!
    1.2、技術支持jdk 1.8、springboot 2.3.4、mybatis-plus 3.4.1、mysql 5.5、springsecurity 5.3.4、springmvc、lombok簡化entity代碼,不用你去寫get、set方法,全部自動生成、gson 2.8.2 將json對象轉化成json字符串
  • 乾貨|新手也能看懂的源碼閱讀技巧
    本文轉載自【微信公眾號:java進階架構師,ID:java_jiagoushi】經微信公眾號授權轉載,如需轉載與原文作者聯繫連結 :https://urlify.cn/ueQ7fy前陣子,師長發了一波springboot源碼的專題,一共八篇,沒看過的可以先看看
  • SpringBoot實現QQ郵箱註冊和登錄
    3.1、UserController.java 3.2、UserMapper.java 3.3、User.java 3.4、MailService.java ,重要。
  • 高性能監控系統 WGCLOUD 更新,重構告警消息推送機制
    WGCLOUD基於java語言開發,是springboot構建的監控系統,支持高並發高性能,核心模塊包括:伺服器集群監控
  • 離線項目實踐之sdk數據收集
    數據收集的方案收集的方式:通過在客戶端嵌入SDK的方式收集用戶行為數據(SDK:一段收集數據的代碼,放到客戶端)以事件作為數據收集的最小單位,當用戶在系統或者APP上觸發定義的事件的時候,產生數據,SDK將產生的數據發送到Nginx伺服器上(通過url發送)js sdk
  • xmake-gradle 插件 v1.0.7 發布,集成 xmake 快速構建 Android JNI...
    目前在 gradle 中做 android jni 相關集成開發,有兩種方式,通過 ndkBuild 或者 CMake 來支持,gradle 也內置了這兩工具的集成但是維護 Android.mk 還是非常繁瑣的,尤其是對於大型項目會比較痛苦,而 cmake 的 dsl 語法不夠簡潔直觀,我個人也不是很喜歡,因此我先前整了 xmake 來實現跨平臺開發,優勢就是: 簡單,快速
  • 可視化Java快速開發平臺,強大工作流引擎
    這款java快速開發平臺是一款支持JAVA/.NETCORE兩種類型,多種類型資料庫,是一套可視化的軟體快速開發工具。相比傳統代碼開發,能快速提高開發效率,幫助公司節省人力成本,擴展性也非常好。XJR快速開發平臺可以根據業務需求定製化開發出適用於自己企業的管理系統。快速平臺開發不要求會美工,會編程,小白也能快速開發出自己想用的業務功能。
  • Springboot學習二:Springboot手動搭建第一個web工程
    功能使用springboot手動搭建一個web工程。搭建步驟創建一個maven工程(簡單骨架)。完成pom中打包類型是pom,pom中繼承springboot資源。創建子工程,繼承自定義父工程(默認也繼承了springboot) 由於父工程繼承了springboot,子工程也具備開發springboot能力,由springboot傳遞過來的各種資源屬性。在pom文件中(子工程)依賴一個開發web應用的資源。
  • 黑馬程式設計師:SpringBoot教程,SpringBoot高級之原理分析
    創建一個模塊,springboot-condition:@SpringBootApplicationpublic class SpringbootConditionApplication {public static void main(String[] args
  • 乾貨|SpringBoot註解大全,值得收藏
    本文轉載自【微信公眾號:java進階架構師,ID:java_jiagoushi】經微信公眾號授權轉載,如需轉載與原文作者聯繫一、註解(annotations)列表@SpringBootApplication
  • Springboot 項目搭建入門
    項目搭建入門環境準備ideamaven工程搭建springboot項目由於其自動配置了很多的依賴,簡化了開發者的配置,因此加快了開發者的開發速度,但是如果對spring 底層等不太了解的人,還是有些懵的,建議大家學習spring 之後再來使用spring boot項目來搭建。
  • SpringBoot第一個程序,HelloWorld
    1、首先打開我們的IDEA工具,點擊Create New Project新建一個項目2、點擊左側的Spring Initializr,選擇相應的jdk版本信息,默認的Default打上小點點,點擊next3、==細節==:在最下面的package的地方默認是com.huagege.springboot
  • 如何用手機給騰訊企鵝極光盒子推送蜜蜂市場
    本文蜜蜂市場示範如何用手機給極光盒子推送安裝蜜蜂市場:步驟一:準備一個安卓手機。將手機和盒子連接到同一個網絡裡。手機會自動推送電視版悟空給盒子安裝。步驟五:打開電視版悟空。然後回到手機悟空,到【應用中心】-【本地】裡找到存儲在手機本地的蜜蜂市場安裝包,點【下載到電視】,然後等待電視自動安裝蜜蜂市場至安裝完成即可注意事項:1、一定要先把電視第三方應用的安裝權限打開2、手機和電視一定要連接到一個網絡裡,否則手機無法給電視推送