1 Star 2 Fork 0

wyulong / serverchan-spring-boot-starter

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README

SpringBoot starter for Serverchan

Server酱推送服务starter,通过本starter可以快速集成Server酱推送服务到springboot工程
Server酱网址: https://sc.ftqq.com

快速开始

添加pom依赖

<dependency>
    <groupId>com.lnold</groupId>
    <artifactId>serverchan-spring-boot-starter</artifactId>
    <version>1.0.0</version>
</dependency>

添加server酱配置

application.properties中添加starter的配置
sckey需通过Server酱网站注册帐户后获取

# server酱sckey
spring.serverchan.sckey=YOUR_SCKEY

使用

注入ServerchanService,即可按照普通Service使用
示例代码:

import com.lnold.serverchan.PushResult;
import com.lnold.serverchan.ServerchanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @Autowired
    private ServerchanService serverchanService;

    @PostMapping("/push")
    public PushResult push(String title,String content){
        PushResult result = serverchanService.sendMessage(title, content);
        if (result.isSuccess()){
            //doSomething()
        }else{
            //doOtherthing()
        }
        return result;
    }
}

Empty file

About

SpringBoot工程集成Server酱推送服务 Server酱:http://sc.ftqq.com expand collapse
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/wyulong/serverchan-spring-boot-starter.git
git@gitee.com:wyulong/serverchan-spring-boot-starter.git
wyulong
serverchan-spring-boot-starter
serverchan-spring-boot-starter
master

Search

344bd9b3 5694891 D2dac590 5694891