ZLMediaKit Spring Boot Starter 使用教程

ZLMediaKit Spring Boot Starter 使用教程

zlm-spring-boot-starter zlm-spring-boot-starter 项目地址: https://gitcode.com/gh_mirrors/zl/zlm-spring-boot-starter

1. 项目目录结构及介绍

zlm-spring-boot-starter
├── src
│   └── main
│       ├── java
│       │   └── io
│       │       └── github
│       │           └── lunasaw
│       │               ├── zlm
│       │               │   ├── api
│       │               │   ├── autoconfigure
│       │               │   ├── service
│       │               │   └── ZlmSpringBootStarterApplication.java
│       └── resources
│           ├── application.properties
│           └── logback.xml
├── zlm-spring-boot-starter-test
│   └── src
│       └── test
│           └── java
│               └── io
│                   └── github
│                       └── lunasaw
│                           └── zlm
│                               └── test
├── .gitignore
├── LICENSE
├── README.md
├── ali-code-style.xml
├── pom.xml
└── zlm-api.md

目录结构说明

  • src/main/java/io/github/lunasaw/zlm: 包含项目的主要代码,包括API接口、自动配置、服务接口等。
  • src/main/resources: 包含项目的配置文件,如application.properties和日志配置文件logback.xml
  • zlm-spring-boot-starter-test: 包含项目的测试代码。
  • .gitignore: Git忽略文件配置。
  • LICENSE: 项目许可证文件。
  • README.md: 项目说明文档。
  • ali-code-style.xml: 代码格式化配置文件。
  • pom.xml: Maven项目配置文件。
  • zlm-api.md: ZLMediaKit API文档。

2. 项目启动文件介绍

ZlmSpringBootStarterApplication.java

package io.github.lunasaw.zlm;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ZlmSpringBootStarterApplication {

    public static void main(String[] args) {
        SpringApplication.run(ZlmSpringBootStarterApplication.class, args);
    }
}

启动文件说明

  • ZlmSpringBootStarterApplication 是项目的启动类,使用@SpringBootApplication注解标记,表示这是一个Spring Boot应用。
  • main方法中调用SpringApplication.run方法启动Spring Boot应用。

3. 项目的配置文件介绍

application.properties

# 应用配置
server.port=8080

# ZLMediaKit配置
zlm.api.secret=your_secret_key
zlm.api.url=http://127.0.0.1:9092

配置文件说明

  • server.port: 配置Spring Boot应用的端口号。
  • zlm.api.secret: 配置ZLMediaKit API的密钥。
  • zlm.api.url: 配置ZLMediaKit API的URL地址。

logback.xml

<configuration>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss} %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>

    <root level="INFO">
        <appender-ref ref="STDOUT" />
    </root>
</configuration>

日志配置文件说明

  • logback.xml 是日志配置文件,使用Logback作为日志框架。
  • STDOUT 是控制台日志输出配置。
  • root 配置日志输出级别为INFO

通过以上配置,可以启动并配置ZLMediaKit Spring Boot Starter项目。

zlm-spring-boot-starter zlm-spring-boot-starter 项目地址: https://gitcode.com/gh_mirrors/zl/zlm-spring-boot-starter

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

裘晴惠Vivianne

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值