YMP 框架使用教程
1. 项目的目录结构及介绍
YMP(YMP是一个非常简单、易用的轻量级Java应用开发框架)项目的目录结构如下:
ymate-platform-v2/
├── website/
├── ymate-platform-cache/
├── ymate-platform-commons/
├── ymate-platform-configuration/
├── ymate-platform-core/
├── ymate-platform-log/
├── ymate-platform-persistence-jdbc/
├── ymate-platform-persistence-mongodb/
├── ymate-platform-persistence-redis/
├── ymate-platform-plugin/
├── ymate-platform-serv/
├── ymate-platform-starter-web/
├── ymate-platform-starter/
├── ymate-platform-validation/
├── ymate-platform-webmvc/
├── .gitignore
├── LICENSE.txt
├── README.md
└── pom.xml
目录介绍:
website/
: 网站相关文件。ymate-platform-cache/
: 缓存模块。ymate-platform-commons/
: 公共模块。ymate-platform-configuration/
: 配置模块。ymate-platform-core/
: 核心模块。ymate-platform-log/
: 日志模块。ymate-platform-persistence-jdbc/
: JDBC持久化模块。ymate-platform-persistence-mongodb/
: MongoDB持久化模块。ymate-platform-persistence-redis/
: Redis持久化模块。ymate-platform-plugin/
: 插件模块。ymate-platform-serv/
: 服务模块。ymate-platform-starter-web/
: Web启动模块。ymate-platform-starter/
: 启动模块。ymate-platform-validation/
: 验证模块。ymate-platform-webmvc/
: WebMVC模块。.gitignore
: Git忽略文件。LICENSE.txt
: 许可证文件。README.md
: 项目说明文件。pom.xml
: Maven配置文件。
2. 项目的启动文件介绍
YMP 项目的启动文件通常位于 ymate-platform-starter-web/
或 ymate-platform-starter/
目录中。具体启动文件可能包括:
Application.java
: 主启动类,负责初始化框架和启动应用。
示例代码:
package net.ymate.platform.starter;
import net.ymate.platform.core.YMP;
public class Application {
public static void main(String[] args) {
YMP.initialize();
YMP.get().start();
}
}
3. 项目的配置文件介绍
YMP 项目的配置文件通常位于 ymate-platform-configuration/
目录中。常见的配置文件包括:
ymp.properties
: 主配置文件,包含框架和模块的配置信息。log4j.properties
: 日志配置文件。
示例配置:
# ymp.properties
ymp.framework.version=2.0.0
ymp.module.enabled=true
ymp.module.cache.enabled=true
ymp.module.persistence.jdbc.enabled=true
ymp.module.persistence.mongodb.enabled=true
ymp.module.persistence.redis.enabled=true
# log4j.properties
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ISO8601} %-5p %c{1}:%L - %m%n
以上是 YMP 框架的基本使用教程,涵盖了项目的目录结构、启动文件和配置文件的介绍。希望对您有所帮助!