### Spring Boot Getting Started Guides Source: https://spring.io/projects/spring-boot Provides links to various guides for getting started with Spring Boot, ranging from quickstart guides to building specific types of applications like RESTful web services. ```en Super quick — try the [Quickstart Guide](https://spring.io/quickstart). More general — try [Building an Application with Spring Boot](https://spring.io/guides/gs/spring-boot/) More specific — try [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/). Or search through all our guides on the [Guides](https://spring.io/guides) homepage. ``` -------------------------------- ### Getting Started Source: https://github.com/simple-robot/simbot-component-onebot This section is intended to guide users on how to quickly start using the Simple Robot OneBot Component, likely including setup instructions or initial configuration steps. ```markdown Quick Start ``` -------------------------------- ### Accessing Quick Start Guide Source: https://github.com/simple-robot/simbot-component-kook Provides a link to the project's quick start guide. Users can quickly get started with the project by following the instructions in the guide. ```APIDOC Link: https://component-kook.simbot.forte.love/ ``` -------------------------------- ### Project Setup and Dependencies Source: https://github.com/simple-robot/simpler-robot/blob/v4-dev/docs/CONTRIBUTING This section outlines the necessary steps to set up the development environment for simpler-robot. It details the required tools, dependencies, and configuration to get started with contributing to the project. ```markdown ## Project Setup To contribute to simpler-robot, you'll need the following: * **Java Development Kit (JDK)**: Version 11 or higher. * **Kotlin**: Version 1.6 or higher. * **Gradle**: Version 7.0 or higher. Clone the repository: ```bash git clone https://github.com/simple-robot/simpler-robot.git cd simpler-robot ``` Build the project: ```bash gradle build ``` This will download all necessary dependencies and compile the project. ``` -------------------------------- ### Getting Started with Spring Boot CLI Source: https://docs.spring.io/spring-boot/docs/3.2.9/reference/html/dependency-versions.html Instructions for installing and using the Spring Boot Command Line Interface (CLI), including shell completion and examples. ```bash getting-started-cli-command-line-completion getting-started-cli-example getting-started-homebrew-cli-installation getting-started-installing-the-cli getting-started-manual-cli-installation getting-started-scoop-cli-installation getting-started-sdkman-cli-installation ``` -------------------------------- ### Quickstart and Learn Section Styling Source: https://spring.io/projects/spring-boot Styling for the quickstart guide's markdown headings and the learn section's guides and layout. ```css .quickstart .markdown h1 { font-size: 3rem; } .quickstart .extra img { height: 675px; position: absolute; right: -100px; top: -320px; } .learn a.learn-guide h1 { color: #086dc3; } .learn a.learn-guide p, .learn a.learn-guide:hover h1 { color: #111; } .learn .newToSpring { margin: 0 auto; overflow: hidden; position: relative; } .learn .newToSpring .wrap { margin: 0 auto; max-width: 900px; position: relative; z-index: 1; } .learn .newToSpring .extra { bottom: -25px; height: 470px; left: 0; position: absolute; z-index: 0; } .learn .extra { position: relative; } .learn .extra .extra-1 { height: 695px; position: absolute; right: -200px; top: -200px; transform: rotate(90deg); width: 695px; } ``` -------------------------------- ### Quickstart and Learn Section Styling Source: https://spring.io/ Styling for the quickstart guide's markdown headings and the learn section's guides and layout. ```css .quickstart .markdown h1 { font-size: 3rem; } .quickstart .extra img { height: 675px; position: absolute; right: -100px; top: -320px; } .learn a.learn-guide h1 { color: #086dc3; } .learn a.learn-guide p, .learn a.learn-guide:hover h1 { color: #111; } .learn .newToSpring { margin: 0 auto; overflow: hidden; position: relative; } .learn .newToSpring .wrap { margin: 0 auto; max-width: 900px; position: relative; z-index: 1; } .learn .newToSpring .extra { bottom: -25px; height: 470px; left: 0; position: absolute; z-index: 0; } .learn .extra { position: relative; } .learn .extra .extra-1 { height: 695px; position: absolute; right: -200px; top: -200px; transform: rotate(90deg); width: 695px; } ``` -------------------------------- ### Quickstart and Learning Section Styling Source: https://spring.io/quickstart/ Styles for the quickstart guide's markdown rendering and learning section links and layout. ```css .quickstart .markdown h1 { font-size: 3rem; } .quickstart .extra img { height: 675px; position: absolute; right: -100px; top: -320px; } .learn a.learn-guide h1 { color: #086dc3; } .learn a.learn-guide p, .learn a.learn-guide:hover h1 { color: #111; } .learn .newToSpring { margin: 0 auto; overflow: hidden; position: relative; } .learn .newToSpring .wrap { margin: 0 auto; max-width: 900px; position: relative; z-index: 1; } .learn .newToSpring .extra { bottom: -25px; height: 470px; left: 0; position: absolute; z-index: 0; } .learn .extra { position: relative; } .learn .extra .extra-1 { height: 695px; position: absolute; right: -200px; top: -200px; transform: rotate(90deg); width: 695px; } ``` -------------------------------- ### Getting Started with Kotlin Source: https://kotlinlang.org/ This section provides a link to the official Kotlin documentation for getting started with the language. It's the primary resource for new users. ```markdown [Get started](/docs/getting-started.html) ``` -------------------------------- ### Registering and Starting a QGBot (Kotlin) Source: https://context7_llms Provides a step-by-step guide on how to register and start a QGBot instance using the QQGuildBotManager in Kotlin. ```kotlin val app = launchSimpleApplication { useQQGuild() } val bot = app.botManagers.get() .register("APP ID", "SECRET", "TOKEN") { // Optionally configure some settings } // Start it bot.start() // Suspend it bot.join() // Or suspend the app directly app.join() ``` -------------------------------- ### Simbot Discord Component Setup and Usage Source: https://github.com/simple-robot/simbot-component-discord This section covers the basic setup and usage of the Simbot Discord Component. It details how to add the component to your project and provides examples of common interactions. ```markdown ## ~ Simple Robot ~ Discord Component ![release](https://img.shields.io/github/v/release/simple-robot/simbot-component-discord) ![release](https://img.shields.io/maven-central/v/love.forte.simbot.component/simbot-component-discord-api) ![stars](https://img.shields.io/github/stars/simple-robot/simbot-component-discord) This component integrates Simbot with Discord, allowing you to build Discord bots using the Simbot framework. ### Installation Add the following dependency to your `pom.xml`: ```xml love.forte.simbot.component simbot-component-discord-api LATEST_VERSION ``` ### Basic Usage ```java import love.forte.simbot.bot.BotManager; import love.forte.simbot.core.SimbotApp; public class Main { public static void main(String[] args) { SimbotApp.run(args, botManager -> { // Your bot logic here // Example: Get a Discord bot instance // Bot discordBot = botManager.getBot(BotPlatform.DISCORD); }); } } ``` ``` -------------------------------- ### Define and Install Plugin Source: https://context7_llms Demonstrates defining a custom Plugin and installing it into an Application. Provides examples for both Kotlin and Java, covering asynchronous and blocking application launches. ```kotlin class FooPlugin : Plugin { companion object Factory : PluginFactory { override val key: PluginFactory.Key = object : PluginFactory.Key {} override fun create(context: PluginConfigureContext, configurer: ConfigurerFunction): FooPlugin { return FooPlugin() } } } launchSimpleApplication { install(FooPlugin) } ``` ```java Applications.launchApplicationAsync(Simple.INSTANCE, configurer -> { configurer.install(FooPlugin.Factory); }); Applications.launchApplicationBlocking(Simple.INSTANCE, configurer -> { configurer.install(FooPlugin.Factory); }); ``` -------------------------------- ### Simplifying QQ Guild Setup with useQQGuild (Kotlin) Source: https://context7_llms Illustrates the use of the `useQQGuild` extension function to simplify the installation of QQ Guild components in Kotlin. ```kotlin val app = launchSimpleApplication { // Install both component identifier and BotManager at the same time useQQGuild() // Or.. // Optionally configure some settings useQQGuild { // Optionally configure the BotManager botManager { // ... } } } ``` -------------------------------- ### General Navigation Links Source: https://play.kotlinlang.org/byExample/ Provides links to get started with Kotlin and a direct link to the 'Hello World' tour, facilitating user progression through the documentation. ```html Get started with Kotlin ``` ```html Hello world ``` -------------------------------- ### Simbot Telegram Bot Setup with Event Listeners (Kotlin) Source: https://github.com/simple-robot/simbot-component-telegram Demonstrates the core setup for a Simbot Telegram application. It shows how to launch the application, install the Telegram component, subscribe to various chat events (like `ChatGroupMessageEvent` and `TelegramPrivateMessageEvent`), and process them. ```kotlin suspend fun main() { val app = launchSimpleApplication { useTelegram() // install Telegram Component } // subscribe to events app.listeners { // subscribe to ChatGroupMessageEvent listen { event -> // process event... event.reply("Hello!") event.reply(At(event.authorId) + "Where are you?".toText()) // Required an result EventResult.empty() } // subscribe to ChatGroupMessageEvent process { event -> // process event... event.content().send("Welcome, " + At(event.member().id)) // Without result in `process` } } app.join() } ``` -------------------------------- ### Configure Plugin Source: https://context7_llms Shows how to configure a Plugin during installation using a DSL/Lambda. Provides examples for both Kotlin and Java, illustrating how to pass configuration parameters. ```kotlin launchSimpleApplication { install(FooPlugin) { // 配置... } } ``` ```java Applications.launchApplicationAsync(Simple.INSTANCE, configurer -> { configurer.install(FooPlugin.Factory, conf -> { // 配置... }); }); Applications.launchApplicationBlocking(Simple.INSTANCE, configurer -> { configurer.install(FooPlugin.Factory, conf -> { // 配置... }); }); ``` -------------------------------- ### Define and Install Component Source: https://context7_llms Demonstrates defining a custom Component with an ID and serializers module, and then installing it into an Application. Includes examples for both Kotlin and Java, covering asynchronous and blocking application launches. ```kotlin class FooComponent : Component { override val id: String = "example.foo" override val serializersModule: SerializersModule = EmptySerializersModule() companion object Factory : ComponentFactory { override val key: ComponentFactory.Key = object : ComponentFactory.Key {} override fun create(context: ComponentConfigureContext, configurer: ConfigurerFunction): FooComponent { return FooComponent() } } } launchSimpleApplication { install(FooComponent) } ``` ```java Applications.launchApplicationAsync(Simple.INSTANCE, configurer -> { configurer.install(FooComponent.Factory); }); Applications.launchApplicationBlocking(Simple.INSTANCE, configurer -> { configurer.install(FooComponent.Factory); }); ``` -------------------------------- ### Configure Component Source: https://context7_llms Shows how to configure a Component during installation using a DSL/Lambda. Provides examples for both Kotlin and Java, illustrating how to pass configuration parameters. ```kotlin launchSimpleApplication { install(FooComponent) { // 配置... } } ``` ```java Applications.launchApplicationAsync(Simple.INSTANCE, configurer -> { configurer.install(FooComponent.Factory, conf -> { // 配置... }); }); Applications.launchApplicationBlocking(Simple.INSTANCE, configurer -> { configurer.install(FooComponent.Factory, conf -> { // 配置... }); }); ``` -------------------------------- ### Creating Your First Spring Boot Application Source: https://docs.spring.io/spring-boot/docs/3.2.9/reference/html/dependency-versions.html A comprehensive guide to creating a first Spring Boot application, covering project setup, dependencies, code structure, and execution. ```java getting-started-first-application getting-started-first-application-annotations getting-started-first-application-auto-configuration getting-started-first-application-code getting-started-first-application-dependencies getting-started-first-application-executable-jar getting-started-first-application-main-method getting-started-first-application-pom getting-started-first-application-run ``` -------------------------------- ### Ktor Server Setup for Simbot Source: https://context7_llms Provides the basic structure for launching a Simbot application and embedding a Ktor HTTP server. It includes constants for signature and timestamp headers and a main function to start the application. ```kotlin private const val SIGNATURE_HEAD = "X-Signature-Ed25519" private const val TIMESTAMP_HEAD = "X-Signature-Timestamp" // 你也可以考虑直接把注册好的 bot 保存起来,而不只是保存 application // 或者使用一些DI方案,都可以。 lateinit var simbotApplication: love.forte.simbot.application.Application suspend fun main() { // 启动simbot application, // 然后启动内嵌的 HTTP 服务 // 当然,具体的启动顺序或逻辑根据你的项目需求而定。 simbotApplication = launchSimbot() embeddedServer(Netty, port = 8080, host = "0.0.0.0", module = Application::module) .start(wait = true) } /** * 启动 simbot application */ ``` -------------------------------- ### Basic simbot Application Setup Source: https://github.com/simple-robot/simpler-robot Demonstrates the basic structure for launching a simbot application and configuring platform components like KOOK and QQ Guild. It shows how to set up the application and then join with a module for bot registration and listener setup. ```kotlin suspend fun main() { launchSimpleApplication { config() } .joinWith { module() } } fun ApplicationFactoryConfigurer<*, *, *>.config() { // Install KOOK and QQ Guild component libraries useKook() useQQGuild() } /** * Configures and applies the built Application to the application */ suspend fun Application.module() { registerBots() registerListeners() } ``` -------------------------------- ### Kotlin/Wasm Development Source: https://book.kotlincn.net/ Guides for getting started with Kotlin/WebAssembly (Wasm), including debugging and JavaScript interoperability. ```kotlin fun main() { println("Hello from Kotlin/Wasm!") // WASI related functions can be called here } ``` -------------------------------- ### Kotlin/JVM Development Source: https://book.kotlincn.net/ Guides for getting started with Kotlin on the Java Virtual Machine (JVM), including comparisons with Java, interoperability, and Spring framework integration. ```kotlin fun main() { println("Hello from Kotlin/JVM!") } ``` ```java public class HelloWorld { public static void main(String[] args) { System.out.println("Hello from Java!"); } } ``` -------------------------------- ### Spring Boot Quickstart Your Project Source: https://spring.io/projects/spring-boot Instructions on how to bootstrap a Spring Boot application using Spring Initializr. ```en Bootstrap your application with [Spring Initializr](https://start.spring.io/). ``` -------------------------------- ### Sentry Integration Source: https://start.spring.io/ Integrates Sentry for application performance monitoring and error tracking. Includes guides for getting started with Spring Boot and general Java platform references. ```APIDOC Sentry: Description: Application performance monitoring and error tracking that help software teams see clearer, solve quicker, and learn continuously. Version Range: [3.4.0.RELEASE,4.0.0.M1) Links: Guide: https://docs.sentry.io/platforms/java/guides/spring-boot/ (Getting Started with Sentry) Reference: https://docs.sentry.io/platforms/java/ ``` -------------------------------- ### How to Use Short Command Line Arguments Source: https://docs.spring.io/spring-boot/docs/3.2.9/reference/html/dependency-versions.html A guide on defining and using short-form command-line arguments for application configuration and startup parameters. ```howto howto.properties-and-configuration.short-command-line-arguments ``` -------------------------------- ### Kotlin Symbol Processing (KSP) Source: https://book.kotlincn.net/ Comprehensive guide to Kotlin Symbol Processing (KSP), a plugin API for Kotlin symbol manipulation, covering overview, quickstart, use cases, examples, and advanced topics. ```APIDOC Kotlin Symbol Processing (KSP): - KSP Overview: Introduction to KSP and its capabilities. - KSP Quickstart: Getting started with KSP. - Why Choose KSP: Reasons for using KSP over other annotation processing tools. - KSP Examples: Practical examples of KSP usage. - KSP Modeling Kotlin Code: How KSP represents Kotlin code internally. - Java Annotation Processing to KSP Reference: Mapping between Java AP and KSP concepts. - Incremental Processing: How KSP handles incremental builds. - Multi-round Processing: Support for multi-round processing. - KSP and Kotlin Multiplatform: Using KSP in multiplatform projects. - Running KSP from Command Line: Executing KSP tasks via the command line. - KSP FAQ: Frequently asked questions about KSP. ``` -------------------------------- ### How to Use WebLogic Source: https://docs.spring.io/spring-boot/docs/3.2.9/reference/html/dependency-versions.html A guide for deploying and running the application on a WebLogic Server, covering traditional deployment methods. ```howto howto.traditional-deployment.weblogic ``` -------------------------------- ### Start and Join Bot (Kotlin) Source: https://context7_llms Provides code examples for starting a bot and then joining its execution context, effectively pausing the current thread until the bot is shut down. ```kotlin bot.start() // 启动bot bot.join() // 挂起并直到bot被关闭 ``` -------------------------------- ### Installing QQGuildComponent and QQGuildBotManager (Java Async) Source: https://context7_llms Demonstrates the asynchronous installation of QQGuildComponent and QQGuildBotManager in Java. ```java var appAsync = Applications.launchApplicationAsync(Simple.INSTANCE, builder -> { builder.install(QQGuildComponent.Factory); builder.install(QQGuildBotManager.Factory); }); // Can be converted to CompletableFuture and perform further operations var appFuture = appAsync.asFuture(); ``` -------------------------------- ### Ktor Server Example Source: https://ktor.io/ A basic Ktor server implementation in Kotlin using the Netty engine. It sets up a root route that responds with 'Hello, world!' when accessed. ```kotlin fun main() { embeddedServer(Netty, port = 8000) { routing { get ("/") { call.respondText("Hello, world!") } } }.start(wait = true) } ``` -------------------------------- ### Launching Simple Application with Plugin Source: https://context7_llms Demonstrates how to launch a simple application and install a custom component (FooComponent) in Kotlin and Java. It also shows how to retrieve the installed component. ```kotlin val app = launchSimpleApplication { install(FooComponent) } // Kotlin 可以直接通过扩展函数根据类型寻找目标 val fooComponent = app.components.find() println(fooComponent) ``` -------------------------------- ### OneBot API Request Examples Source: https://github.com/botuniverse/onebot-11/blob/master/communication/http Demonstrates how to send requests to the OneBot API using different methods and parameter passing techniques. Includes examples for GET with query parameters and POST with JSON payload. ```APIDOC OneBot HTTP API: Base URL: http://: Actions (e.g., /send_private_msg): Methods: GET or POST Parameter Passing: 1. Query Parameters (GET): Example: http://127.0.0.1:5700/send_private_msg?user_id=1000010000&message=hello - Parameters are appended to the URL. - Values must be URL-encoded. 2. Form Data (POST): Content-Type: application/x-www-form-urlencoded Example Body: user_id=1000010000&message=hello - Parameters are sent in the request body. - Values must be URL-encoded. 3. JSON Payload (POST): Content-Type: application/json Example Body: { "user_id": 1000010000, "message": "hello" } - Parameters are sent as a JSON object in the request body. Notes: - Ensure the correct Content-Type header is set for POST requests. - Refer to the API documentation for specific actions, parameters, and response formats. ``` ```HTTP GET /send_private_msg?user_id=1000010000&message=hello HTTP/1.1 Host: 127.0.0.1:5700 POST /send_private_msg HTTP/1.1 Host: 127.0.0.1:5700 Content-Type: application/json { "user_id": 1000010000, "message": "hello" } ``` -------------------------------- ### Custom Component Installer (Java) Source: https://context7_llms Provides a Java implementation for a custom component installer in Simbot. It implements `SimbotComponentInstaller` and utilizes `ComponentInstaller` for setup. The `@Component` annotation signifies Spring management. ```Java @Component // 交给 Spring 管理 public class MyComponentInstaller implements SimbotComponentInstaller { @Override public void install(@NotNull ComponentInstaller installer) { // 配置或安装,同一个工厂实例的多次配置会被合并 installer.install(...); installer.install(..., config -> { ... }); } } ``` -------------------------------- ### Deployment Next Steps Source: https://docs.spring.io/spring-boot/docs/3.2.9/reference/html/dependency-versions.html Guidance on what to do after the initial deployment of the application. ```text "deployment-whats-next":"deployment.whats-next" ``` -------------------------------- ### Data Initialization and Migration Source: https://docs.spring.io/spring-boot/docs/3.2.9/reference/html/dependency-versions.html Instructions for initializing databases using various methods, including Flyway, Liquibase, basic SQL scripts, Hibernate, and JPA. ```howto howto.data-initialization.migration-tool.flyway howto.data-initialization.migration-tool.liquibase howto.data-initialization.dependencies howto.data-initialization.dependencies.depends-on-initialization-detection howto.data-initialization.dependencies.initializer-detection howto.data-initialization.using-basic-sql-scripts howto.data-initialization.using-hibernate howto.data-initialization.using-jpa howto.data-initialization.batch howto.data-initialization.configure-two-datasources howto.data-initializatio ``` -------------------------------- ### Kotlin/JS Project Setup and Execution Source: https://book.kotlincn.net/ Guides on setting up, running, and debugging Kotlin/JS projects, including continuous compilation and test execution. ```kotlin import kotlinx.browser.document fun main() { document.write("Hello from Kotlin/JS!") } ``` -------------------------------- ### Database Initialization Source: https://docs.spring.io/spring-boot/docs/3.2.9/reference/html/dependency-versions.html This guide explains how to initialize your database schema and populate it with data when your Spring Boot application starts. ```java import org.springframework.boot.CommandLineRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class DatabaseConfig { @Bean public CommandLineRunner initDatabase() { return args -> { // Code to initialize or populate the database System.out.println("Database initialization complete."); }; } } ``` -------------------------------- ### Kotlin Resources Examples Source: https://docs.spring.io/spring-boot/docs/3.2.9/reference/html/dependency-versions.html Provides practical examples of resource handling in Kotlin-based Spring Boot projects. ```kotlin features.kotlin.resources.examples ``` -------------------------------- ### Retrieve Component Source: https://context7_llms Illustrates how to retrieve installed components from an Application after it has been launched. Includes examples for both Kotlin and Java, showing iteration over the components collection. ```kotlin val app = launchSimpleApplication { install(FooComponent) } app.components.forEach { component -> // 所有注册了的组件 } ``` ```java Applications.launchApplicationAsync(Simple.INSTANCE, configurer -> { configurer.install(FooComponent.Factory); }).asFuture().thenAccept(app -> { for (var component : app.getComponents()) { // 所有注册了的组件... } }); var app = Applications.launchApplicationBlocking(Simple.INSTANCE, configurer -> { configurer.install(FooComponent.Factory); }); for (var component : app.getComponents()) { // 所有注册了的组件... } ``` -------------------------------- ### Core Project Files Source: https://github.com/simple-robot/simbot-component-qq-guild/tree/dev/main/samples This snippet lists essential project files and directories, including source code, tests, documentation, and configuration files. ```kotlin simbot-component-qq-guild-api simbot-component-qq-guild-core simbot-component-qq-guild-internal-ed25519 simbot-component-qq-guild-stdlib ``` -------------------------------- ### Retrieve Plugin Source: https://context7_llms Illustrates how to retrieve installed plugins from an Application after it has been launched. Includes examples for both Kotlin and Java, showing iteration over the plugins collection. ```kotlin val app = launchSimpleApplication { install(FooPlugin) } app.plugins.forEach { plugin -> // 所有注册了的插件 } ``` ```java Applications.launchApplicationAsync(Simple.INSTANCE, configurer -> { configurer.install(FooPlugin.Factory); }).asFuture().thenAccept(app -> { for (var component : app.getPlugins()) { // 所有注册了的插件... } }); var app = Applications.launchApplicationBlocking(Simple.INSTANCE, configurer -> { configurer.install(FooPlugin.Factory); }); for (var plugin : app.getPlugins()) { // 所有注册了的插件... } ``` -------------------------------- ### Installing QQGuildComponent and QQGuildBotManager (Kotlin) Source: https://context7_llms Shows how to install the QQGuildComponent and QQGuildBotManager in a Simple Application in Kotlin. ```kotlin val app = launchSimpleApplication { install(QQGuildComponent) // Don't forget to install the Component identifier install(QQGuildBotManager) { // Optionally, configure some settings, like a parent CoroutineContext for all Bots } } ``` -------------------------------- ### Launch Simple Application (Kotlin) Source: https://context7_llms Example of launching a simple application using Kotlin, with a placeholder for configuration. ```kotlin val application = launchSimpleApplication { // 配置... } ``` -------------------------------- ### Build and Gradle Configuration Source: https://github.com/Kotlin/kotlinx-io/ Lists the primary build configuration files for the project, including the main build script, properties, and Gradle wrapper scripts. ```markdown [build.gradle.kts](/Kotlin/kotlinx-io/blob/master/build.gradle.kts "build.gradle.kts") [gradle.properties](/Kotlin/kotlinx-io/blob/master/gradle.properties "gradle.properties") [gradlew](/Kotlin/kotlinx-io/blob/master/gradlew "gradlew") [gradlew.bat](/Kotlin/kotlinx-io/blob/master/gradlew.bat "gradlew.bat") [settings.gradle.kts](/Kotlin/kotlinx-io/blob/master/settings.gradle.kts "settings.gradle.kts") ``` -------------------------------- ### Spring Boot Kotlin Demo Projects Source: https://docs.spring.io/spring-boot/3.3.3/reference/features/kotlin.html This section provides links to various GitHub repositories that serve as examples for using Kotlin with Spring Boot. These examples cover different use cases such as standard Spring Boot with JPA, reactive programming with WebFlux and MongoDB, full-stack applications with Kotlin2js, and migration guides. ```kotlin spring-boot-kotlin-demo: regular Spring Boot + Spring Data JPA project mixit: Spring Boot 2 + WebFlux + Reactive Spring Data MongoDB spring-kotlin-fullstack: WebFlux Kotlin fullstack example with Kotlin2js for frontend instead of JavaScript or TypeScript spring-petclinic-kotlin: Kotlin version of the Spring PetClinic Sample Application spring-kotlin-deepdive: a step by step migration for Boot 1.0 + Java to Boot 2.0 + Kotlin spring-boot-coroutines-demo: Coroutines sample project ``` -------------------------------- ### Main Application Entry Point Source: https://github.com/simple-robot/simpler-robot The main function that launches the Simbot application. It uses `launchSimpleApplication` to start the application with the provided configuration and then joins with the application's module for further setup. ```kotlin suspend fun main() { launchSimpleApplication { config() } .joinWith { module() } } ``` -------------------------------- ### Register QQ Guild Bot (Java - Async) Source: https://context7_llms Shows how to launch an application asynchronously, install QQ Guild components, find the BotManager, register a bot with credentials and configurations (including event intents and webhook usage), and handle the bot's startup process using Futures. ```Java public static void main(String[] args) { final var applicationAsync = Applications.launchApplicationAsync( Simple.INSTANCE, configurer -> { // 安装QQGuild组件相关内容 configurer.install(QQGuildComponent.Factory); configurer.install(QQGuildBotManager.Factory); // 其他... } ); applicationAsync .asFuture() // Application 转化为 Future .thenApply(app -> { // 配置 configure(app); return app; }) .thenCompose(Application::asFuture) // 阻塞这个Future直到Application被cancel .join(); } public static void configure(Application application) { // 寻找所需的BotManager // 可以选择遍历寻找 final var found = application.getBotManagers().stream() .filter(it -> it instanceof QQGuildBotManager) .map(it -> (QQGuildBotManager) it) .findFirst() .orElseThrow(); // 也可以选择使用辅助API final var qqGuildBotManager = QQGuildBotManagerUsageKt .firstQQGuildBotManager(application.getBotManagers()); // 注册Bot // 注册 final var bot = qqGuildBotManager.register( "appid", "secret", "token", config -> { // 一些其他的可选配置属性 // 大部分属性都在 botConfigure 内配置 config.botConfig(botConfig -> { // 比如添加订阅QQ群聊和C2C的事件。 // 如果不配置,默认情况下仅订阅: // - 频道相关事件 // - 频道成员相关事件 // - 公域消息相关事件 botConfig.setIntentsValue( // 位运算合并 QQ群聊和C2C事件 的intents值 botConfig.getIntentsValue() | EventIntents.GroupAndC2CEvent.INSTANCE.getIntentsValue() ); // 如果要使用 [[[Webhook|component-qq-guild-webhook.html]]] 的订阅方式, // 通过此属性取消 ws 的连接 botConfig.setDisableWs(true); }); // 外层是独属于组件类型的某些配置 config.setCacheConfig(null); // 其他... }); // 启动 final var future = bot.startAsync().whenComplete((r, ex) -> { // 在使用 Future 的时候,记得处理异常 if (ex != null) { Logger.getGlobal().log( Level.SEVERE, "bot启动出现异常!", ex ); } }); // 你可以选择处理等待这个future,也可以选择不管他,直接在异步中处理。 } ```