|
|
1 개월 전 | |
|---|---|---|
| .. | ||
| src | 1 개월 전 | |
| README.md | 1 개월 전 | |
| pom.xml | 1 개월 전 | |
lingyue-starter 是灵越智报的单体应用启动器,整合了所有微服务模块为一个可独立运行的应用。
lingyue-starter/
├── pom.xml
└── src/main/
├── java/com/lingyue/
│ ├── LingyueApplication.java # 主启动类
│ └── config/ # 配置类
│ ├── SpringDocConfig.java # API文档配置
│ ├── RequestParameterLoggingConfig.java # 请求日志配置
│ └── interceptor/
│ └── RequestParameterLoggingInterceptor.java
└── resources/
├── application.yml # 主配置文件
├── application-dev.yml # 开发环境配置
├── application-prod.yml # 生产环境配置
├── mybatis/
│ └── mybatis-config.xml # MyBatis配置
├── i18n/
│ └── messages.properties # 国际化资源
└── banner.txt # 启动Banner
cd backend
mvn clean install
cd lingyue-starter
mvn spring-boot:run
或者直接运行jar包:
java -jar lingyue-starter.jar
在 application.yml 中配置:
app:
name: 灵越智报
version: 2.0.0
uploadBaseDir: /tmp/lingyue-zhibao
spring:
datasource:
druid:
url: jdbc:postgresql://localhost:5432/lingyue_zhibao
username: postgres
password: postgres
开发环境默认启用API文档,生产环境自动禁用:
springdoc:
api-docs:
enabled: true # dev环境启用,prod环境禁用
使用 application-dev.yml,包含本地开发配置。
使用 application-prod.yml,通过环境变量配置:
export DB_USERNAME=postgres
export DB_PASSWORD=your_password
export JWT_SECRET=your_jwt_secret
export REDIS_HOST=localhost
export REDIS_PORT=6379
API文档按服务分组:
spring.cloud.nacos.discovery.enabled: false)| 特性 | 微服务架构 | 单体应用(Starter) |
|---|---|---|
| 部署方式 | 多个独立服务 | 单个应用 |
| 服务发现 | 需要Nacos | 不需要 |
| API网关 | 需要Gateway | 不需要 |
| 配置管理 | 分散在各服务 | 统一配置 |
| 适用场景 | 大型项目、分布式 | 中小型项目、快速开发 |
lingyue-starter 快速开发和调试