ZLMediaKit 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 项目地址: https://gitcode.com/gh_mirrors/zl/zlm-spring-boot-starter