跳至主要內容
番茄

番茄

标题 2

这里是内容。

标题 3

这里是内容。


bug君小于 1 分钟蔬菜
页面配置

more 注释之前的内容被视为文章摘要。


Ms.Hope大约 1 分钟使用指南页面配置使用指南
消息推送

在 Spring Boot 项目中,服务端推送消息到客户端的常用方法包括使用 WebSocket、Server-Sent Events (SSE) 和 HTTP 长轮询。以下是如何使用这些技术的简要介绍和示例:

1. 使用 WebSocket

提示

WebSocket 是一种全双工通信协议,允许服务端和客户端之间进行实时通信。

1.1 添加依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-websocket</artifactId>
</dependency>

bug君大约 4 分钟服务端推送消息SSEwebsocket服务端推送消息
开发idea插件

1. 简介

2. 准备工作

3. 开始


bug君小于 1 分钟idea插件idea插件开发idea插件idea
配置文件

1. 配置

1.1 基本类型

1.1.1 字符串

app:
  name: MyApplication

bug君大约 1 分钟javaspringboot配置文件springboot配置文件yaml
代码段

1. 正则匹配

    private List<String> extractKeywords(String title) {
        List<String> keywords = new ArrayList<>();
        
        // 匹配关键词的正则表达式
        String regex = "\\b(?:and|or|not|\\(|\\))+\\b";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(title);
        // 用空格替换所有逻辑运算符和括号
        String cleanTitle = matcher.replaceAll(" ");
        // 拆分字符串并添加到关键词列表中
        String[] words = cleanTitle.split("\\s+");
        for (String word : words) {
            if (!word.isEmpty()) {
                keywords.add(word);
            }
        }
        
        return keywords;
    }


bug君小于 1 分钟
项目中使用

1. pom学习

2. 常用插件

2.1 打包

2.1.1 依赖包

2.1.2 可执行包


bug君小于 1 分钟