本文介绍如何基于盘古开发框架开发一个单体分层架构的利用。文中所述仅为搭建一个单体利用的根本框架,减少配置核心、数据长久化、缓存等能力请参考开发指南的相干章节。

背景

软件架构的实质是一种在特定资源背景下折中均衡后谋求业务增长的一门艺术。尽管盘古框架的规范姿态是散布式微服务开发,但决定技术开发架构选型的因素很多,单体利用仍旧有很多利用场景。因而,盘古框架不会绑定用户到一个固定的开发范式和架构上,而是反对随便组合、主动拆卸、灵便插拔。 既能构建大并发高可用的散布式微服务架构也能搭建玲珑的垂直单体分层架构。

装置相干盘古模块

<!-- 盘古 Parent --><parent>    <groupId>com.gitee.pulanos.pangu</groupId>    <artifactId>pangu-parent</artifactId>    <version>latest.version.xxx</version>    <relativePath/></parent><!-- 根底模块 --><dependency>    <groupId>com.gitee.pulanos.pangu</groupId>    <artifactId>pangu-spring-boot-starter</artifactId></dependency><!-- Web模块 --><dependency>    <groupId>com.gitee.pulanos.pangu</groupId>    <artifactId>pangu-web-spring-boot-starter</artifactId></dependency>

本地配置

为便于了解,本文基于本地配置的形式编写。若改为规范的 Nacos 配置核心模式,请参阅:配置核心 章节。
spring.application.name=pangu-examples-empty-webspring.jackson.time-zone=GMT+8logging.level.root=INFOlogging.level.com.gitee.pulanos.pangu=INFO

启动入口

@SpringBootApplicationpublic class EmptyWebPanguApplication {    public static void main(String[] args) {        PanGuApplicationBuilder.init(EmptyWebPanguApplication.class).run(args);    }}

本文相干范例源码

  • pangu-examples-empty-web:单体分层Web利用范例

下一步

持续浏览其它章节获取你想要的答案或通过咱们的 开发者社区 寻求更多帮忙。

参考文献

  • 开发架构模式比照
  • 如何开发单体利用