续篇——源码部署LAMP环境上线——禅道项目

上篇:LNMP环境部署WordPress——使用源码包安装方式部署环境-CSDN博客

目录

一.前提准备

1. 名词区别

2. 下载项目软件包

3. 上传项目源码到虚拟机并解压

 二.安装Apache

1. 环境清理

 2.关闭Nginx

3. 下载Apache

4.  下载APR组件

4.1 安装apr

4.2 安装apr-util组件

5. 安装httpd

6. 将httpd服务加入systemd

 三.启动禅道


一.前提准备

本次实验部署基于上篇的源码部署的环境,上篇搭建拉博客项目,本文描述更换禅道项目。

禅道是一款国产开源项目管理软件,它的功能包含产品管理、项目管理、质量管理、文档管理、组织管理和事务管理等。作为专业的研发项目管理软件,功能覆盖了研发项目管理的整体核心流程。

1. 名词区别

在官网的一些软件包版本时,常见的尾缀单词的所代表意思如下:

  1. LTS:Long-Term Support(长期支持)。这种版本通常会获得更长时间的技术支持和更新,适合那些希望在较长时间内维护和使用稳定版本的用户。

  2. RC:Release Candidate(发布候选版)。这种版本是在正式发布之前的最终测试阶段,通常用于征求用户反馈和进行最后的调整。

  3. Beta:Beta版。这种版本是在软件开发过程中的测试阶段,通常包含了新功能和改进,但可能存在一些未解决的问题。

  4. Alpha:Alpha版。这是开发初期的版本,通常仅用于内部测试或限定的测试群体中,可能存在较多的问题和缺陷。

  5.  Stable:稳定版)通常表示这是一个已经经过充分测试,没有明显 bug 或重大问题的版本。这是最适合普通用户使用的版本,因为它们提供了可靠的功能和性能,可以用于日常使用而不太容易出现意外情况。

2. 下载项目软件包

官网链接:禅道下载 - 禅道开源项目管理软件

官方手册:选择适合您的安装方法 - 禅道使用手册 - 禅道开源项目管理软件

我下载好的包链接:https://pan.baidu.com/s/1PAjaDHnEAfAKuw4VYDAitA?pwd=df3l 
提取码:df3l

使用链接下载:

[root@localhost ~]# wget -P /opt https://www.zentao.net/dl/zentao/20.0/ZenTaoPMS-20.0-zbox_amd64.tar.gz

以上途径选其一即可. 

3. 上传项目源码到虚拟机并解压
[root@localhost ~]# cd /opt

#下载至虚拟机后解压
[root@localhost opt]# tar -zxvf ZenTaoPMS-20.0-zbox_amd64.tar.gz

注:Linux一键安装包必须直接解压到/opt目录下。(援引官方)

 二.安装Apache

(本实验基于上篇文章,因此避免80端口冲突)

1. 环境清理
[root@localhost ~]# yum -y remove httpd
 2.关闭Nginx
[root@localhost ~]# systemctl stop nginx
[root@localhost ~]# systemctl status nginx
● nginx.service - nginx
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since 六 2024-05-11 20:44:00 CST; 6s ago
  Process: 47401 ExecStop=/usr/sbin/nginx -s quit (code=exited, status=0/SUCCESS)
  Process: 46671 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
 Main PID: 46672 (code=exited, status=0/SUCCESS)

5月 11 16:53:21 localhost.localdomain systemd[1]: Starting nginx...
5月 11 16:53:21 localhost.localdomain nginx[46671]: nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
5月 11 16:53:21 localhost.localdomain systemd[1]: Started nginx.
5月 11 20:44:00 localhost.localdomain systemd[1]: Stopping nginx...
5月 11 20:44:00 localhost.localdomain nginx[47401]: nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
5月 11 20:44:00 localhost.localdomain systemd[1]: Stopped nginx.

#下载常用工具包
[root@localhost ~]# yum install -y net-tools 
[root@localhost ~]# netstat -ntlp | grep nginx
#这里没有提示代表成功停止拉nginx
3. 下载Apache

本文使用版本2.4.59

[root@localhost ~]# wget https://downloads.apache.org/httpd/httpd-2.4.59.tar.gz
4.  下载APR组件
[root@localhost ~]# wget http://archive.apache.org/dist/apr/apr-1.5.0.tar.gz
[root@localhost ~]# wget http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz
[root@localhost ~]# ll
总用量 11536
-rw-r--r--  1 root root 1016391 11月 17 2013 apr-1.5.0.tar.gz
-rw-r--r--  1 root root  874044 9月  20 2014 apr-util-1.5.4.tar.gz
-rw-r--r--  1 root root 9843252 4月   4 21:33 httpd-2.4.59.tar.gz

#可以看到此处我下载到root目录下的apache的源码包和apr组件的包
4.1 安装apr
#解压apr
[root@localhost ~]# tar -xf apr-1.5.0.tar.gz
#进入目录
[root@localhost ~]# cd apr-1.5.0
#配置编译apr,生成Makefile,一般常用的有 --prefix=PREFIX 这个选项的意思是定义软件包安装到哪里
[root@localhost apr-1.5.0]# ./configure --prefix=/usr/local/src/apr

#此处等待几秒即可完成

#编译安装
[root@localhost apr-1.5.0]# make && make install

#这里也是等待几秒就可以完成
#进入apr的路径进行查看,默认情况下,系统搜索库文件的路径只有/lib,/usr/lib
#我们需要进行修改在/etc/ld.so.conf.d/中创建以.conf为后缀名的文件
#而后把要增添的路径直接写至此文件中。此时库文件增添的搜索路径重启后有效,若要使用增添的路径立即生效则要使用ldconfig命令

[root@localhost apr-1.5.0]# cd /usr/local/src/apr/
[root@localhost apr]# ll
总用量 0
drwxr-xr-x 2 root root  26 5月  11 21:26 bin
drwxr-xr-x 2 root root 108 5月  11 21:26 build-1
drwxr-xr-x 3 root root  19 5月  11 21:26 include
drwxr-xr-x 3 root root 140 5月  11 21:26 lib

[root@localhost apr]# cd /etc/ld.so.conf.d/
[root@localhost ld.so.conf.d]# echo /usr/local/src/apr/lib/ >apr.conf
[root@localhost ld.so.conf.d]# cd -   #切换回上一个工作目录
/usr/local/src/apr

#使命令生效
[root@localhost apr]# ldconfig

#将头文件软链接到/usr/include目录下
[root@localhost apr]# ln -s /usr/local/src/apr/include/ /usr/include/apr
[root@localhost apr]# ll /usr/include/apr 
lrwxrwxrwx 1 root root 27 5月  11 21:31 /usr/include/apr -> /usr/local/src/apr/include/
4.2 安装apr-util组件

#返回下载存放的目录
[root@localhost apr]# cd ~
#下载依赖
[root@localhost ~]# yum install dnf -y
[root@localhost ~]# dnf -y install expat-devel libxml2-devel pcre-devel
#解压apr-util
[root@localhost ~]# tar -xf apr-util-1.5.4.tar.gz
#进入解压目录
[root@localhost ~]# cd apr-util-1.5.4
#编译配置
[root@localhost apr-util-1.5.4]# ./configure --prefix=/usr/local/src/apr-util --with-apr=/usr/local/src/apr

#此处等待几秒即可,生成Makefile文件,需要伴随着上一个指定的依赖

[root@localhost apr-util-1.5.4]# make && make install
#等待几秒即可完成
#切换到apr-util安装目录进行查看,默认情况下,系统搜索库文件的路径只有/lib,/usr/lib
#我们需要进行修改在/etc/ld.so.conf.d/中创建以.conf为后缀名的文件
#而后把要增添的路径直接写至此文件中。此时库文件增添的搜索路径重启后有效,若要使用增添的路径立即生效则要使用ldconfig命令
[root@localhost apr-util-1.5.4]# cd /usr/local/src/apr-util/
[root@localhost apr-util]# ll
总用量 0
drwxr-xr-x 2 root root  26 5月  11 21:46 bin
drwxr-xr-x 3 root root  19 5月  11 21:46 include
drwxr-xr-x 3 root root 164 5月  11 21:46 lib

[root@localhost apr-util]# cd /etc/ld.so.conf.d/
[root@localhost ld.so.conf.d]# echo /usr/local/src/apr-util/ >apr-util.conf
[root@localhost ld.so.conf.d]# cd -   #切换回上一个工作目录
/usr/local/src/apr-util 

#使其生效
[root@localhost apr-util]# ldconfig 
#将头文件软链接到/usr/include目录下
[root@localhost apr-util]# ln -s /usr/local/src/apr-util/include/ /usr/include/apr-util
[root@localhost apr-util]# ll /usr/include/apr-util
lrwxrwxrwx 1 root root 32 5月  11 21:50 /usr/include/apr-util -> /usr/local/src/apr-util/include/
5. 安装httpd
#回到源码包目录
[root@localhost ~]# cd
#解压
[root@localhost ~]# tar -xf httpd-2.4.59.tar.gz
#进入解压后目录
[root@localhost ~]# cd httpd-2.4.59

#配置编译httpd,生成make文件
[root@localhost httpd-2.4.59]# ./configure --prefix=/usr/local/src/httpd --with-apr=/usr/local/src/apr --with-apr-util=/usr/local/src/apr-util

#此处等待几秒编译即可

[root@localhost httpd-2.4.59]# make && make install

#此处等待15-30秒左右
#进入安装目录
[root@localhost httpd-2.4.59]# cd /usr/local/src/httpd/
[root@localhost httpd]# ls
bin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules

#将头文件软链接到/usr/include目录下
[root@localhost httpd]# ln -s /usr/local/src/httpd/include/ /usr/include/httpd
[root@localhost httpd]# ll  /usr/include/httpd
lrwxrwxrwx 1 root root 29 5月  11 22:03 /usr/include/httpd -> /usr/local/src/httpd/include/

#配置httpd的全局环境变量,并生成效果
[root@lnh httpd]# echo "export PATH=$PATH:/usr/local/src/httpd/bin" > /etc/profile.d/httpd.sh
[root@lnh httpd]# source /etc/profile.d/httpd.sh
[root@localhost httpd]# which httpd 
/usr/local/src/httpd/bin/httpd

[root@localhost httpd]# vim /etc/man_db.conf +23
#在行添加上如下内容,具体可看下图

MANDATORY_MANPATH                 /usr/local/src/httpd/man

#开启服务
[root@localhost httpd]# httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
httpd (pid 75183) already running

#查看端口
[root@localhost httpd]# netstat -antp | grep httpd
tcp6       0      0 :::80                   :::*                    LISTEN      75183/httpd 

[root@localhost httpd]# ss -antl
State       Recv-Q Send-Q                         Local Address:Port                                        Peer Address:Port              
LISTEN      0      128                                127.0.0.1:9000                                                   *:*                  
LISTEN      0      128                                        *:22                                                     *:*                  
LISTEN      0      80                                      [::]:3306                                                [::]:*                  
LISTEN      0      128                                     [::]:80                                                  [::]:*                  
LISTEN      0      128                                     [::]:22                                                  [::]:*  
6. 将httpd服务加入systemd
[root@localhost httpd]# cd /usr/lib/systemd/system
[root@localhost system]# cp sshd.service httpd.service
[root@localhost system]# vim httpd.service 

#这个文件里如果有,就删除全部,并新增如下内容
[Unit]
Description=httpd server daemon   #服务
After=network.target sshd-keygen.target

[Service]
Type=forking
ExecStart=/usr/local/src/httpd/bin/httpd  #服务安装的地方 开启
ExecStop=/usr/local/src/httpd/bin/httpd  -s stop  #停止
ExecReload=/bin/kill -HUP $MAINPID    #重新加载并发出信号(对pid对组程序的进程号)可留可删

[Install]
WantedBy=multi-user.target

#重新加载一下并生效
[root@localhost system]# systemctl daemon-reload 
#查看一下这个服务状态
[root@localhost system]# systemctl status httpd.service 
● httpd.service - httpd server daemon
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

#这里看到80端口在使用
[root@localhost system]# ss -antl
State       Recv-Q Send-Q                         Local Address:Port                                        Peer Address:Port              
LISTEN      0      128                                127.0.0.1:9000                                                   *:*                  
LISTEN      0      128                                127.0.0.1:3306                                                   *:*                  
LISTEN      0      128                                        *:22                                                     *:*                  
LISTEN      0      128                                     [::]:80                                                  [::]:*                  
LISTEN      0      128                                     [::]:22                                                  [::]:*        

#这里要确保80端口关闭,这里httpd服务没开,80端口还被监听着,因此我要关闭它,保证后续命令不会出现错误
#下载并确保lsof命令可以用
[root@localhost system]# yum -y install lsof

#查看80端口被哪些进程占用
[root@localhost system]# lsof -i :80
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd   75184 daemon    4u  IPv6 143438      0t0  TCP *:http (LISTEN)
httpd   75185 daemon    4u  IPv6 143438      0t0  TCP *:http (LISTEN)
httpd   75186 daemon    4u  IPv6 143438      0t0  TCP *:http (LISTEN)

#强制杀死这些进程
[root@localhost system]# kill -9 75184 75185 75186
#再次查看是否完全关闭
[root@localhost system]# lsof -i :80
[root@localhost system]# ss -antl
State       Recv-Q Send-Q                         Local Address:Port                                        Peer Address:Port              
LISTEN      0      128                                127.0.0.1:9000                                                   *:*                  
LISTEN      0      128                                        *:22                                                     *:*                  
LISTEN      0      128                                     [::]:22                                                  [::]:*     

#经确认,80端口无占用

 三.启动禅道

#确保关闭mysql和apache
[root@localhost ~]# systemctl stop mysqld 
[root@localhost ~]# systemctl stop httpd

启动

[root@localhost ~]# /opt/zbox/zbox start
 23:40:16.02 INFO  ==> Starting service with Apache port=80, MySQL port=3306...
 23:40:16.03 INFO  ==> Starting mysql service...
 23:40:17.15 INFO  ==> Starting apache service...
 23:40:17.20 INFO  ==> Starting xxd service...
 23:40:17.21 INFO  ==> Starting roadrunner service...
=============================================================================
Service             Port           Status    Version   Comment        
=============================================================================
Apache              80             running   2.4.59                   
PHP                 -              running   8.1.28    prefork        
MySQL               3306           running   10.6.16   MariaDB        
XXD                 11443 11444    running   8.1                      
Roadrunner          -              running   2023.3.12 @zentao        

=============================================================================
Application         Version        
=============================================================================
zentao              20.0           
adminer             4.8.1    

此时在浏览器输入IP即可访问到 , 点击“开源版”,进入到禅道登录界面, 输入默认用户名admin,密码123456,进入后修改密码。

  

到此,就正式部署好拉,可以开始研究一下禅道项目了!

  • 24
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
本篇文章是 Spring Boot 实践之十三 9 Spring Boot综合项目实战——个人博客系统管理模块 的续篇,本次将介绍如何实现个人博客系统的拓展模块。 在实际开发中,我们常常需要对系统进行扩展,添加一些新的功能模块。为了不影响原有代码的结构和功能,我们可以将这些新功能模块独立成为一个子模块,然后通过配置文件等方式将其与原有系统进行整合。 本文将以一个个人博客系统为例,介绍如何实现博客的拓展模块,具体包括以下几个方面: 1. 拓展模块的设计和实现 2. 拓展模块的集成和配置 3. 拓展模块的使用示例 ## 1. 拓展模块的设计和实现 在本例中,我们将实现一个博客系统的拓展模块,该模块主要提供以下两个功能: 1. 统计博客文章的阅读量并显示 2. 在博客页面添加底部的版权声明 ### 1.1 统计博客文章的阅读量并显示 首先,我们需要在数据库中添加一个字段来存储博客文章的阅读量。在本例中,我们在 `blog` 表中添加 `read_count` 字段来存储阅读量。 ```sql ALTER TABLE `blog` ADD COLUMN `read_count` INT NOT NULL DEFAULT 0 COMMENT '阅读量' AFTER `update_time`; ``` 接下来,在博客文章页面中添加一个阅读量的显示。我们可以在博客文章详情页面的右侧添加一个阅读量的区域,显示该文章的阅读量。具体的实现方式为: 1. 在博客文章详情页面中添加一个阅读量的区域。 2. 在加载博客文章详情页面时,通过 AJAX 请求统计该文章的阅读量,并更新阅读量区域的显示。 具体的代码实现如下: 在博客文章详情页面中添加一个阅读量的区域: ```html <div class="blog-sidebar-item"> <div class="blog-sidebar-title">阅读量</div> <div class="blog-sidebar-content"> <span id="read-count">0</span> </div> </div> ``` 在加载博客文章详情页面时,通过 AJAX 请求统计该文章的阅读量,并更新阅读量区域的显示。具体的实现方式为: ```javascript $(function () { // 统计阅读量 var blogId = $("#blogId").val(); $.ajax({ url: "/blog/read/" + blogId, type: "POST", success: function (result) { if (result && result.success) { $("#read-count").text(result.data); } else { $("#read-count").text(0); } } }); }); ``` 在服务器端,我们需要实现一个接口来统计博客文章的阅读量,并将其保存到数据库中。具体的实现方式为: ```java @RestController @RequestMapping("/blog") public class BlogController { ... /** * 统计博客文章的阅读量 * * @param blogId 博客文章ID * @return 统计结果 */ @PostMapping("/read/{blogId}") public Result<Integer> readBlog(@PathVariable("blogId") Long blogId) { int readCount = blogService.readBlog(blogId); return Result.success(readCount); } ... } ``` 在 `BlogService` 中实现 `readBlog` 方法: ```java @Service public class BlogServiceImpl implements BlogService { ... /** * 统计博客文章的阅读量 * * @param blogId 博客文章ID * @return 统计结果 */ @Override public int readBlog(Long blogId) { Blog blog = blogMapper.selectByPrimaryKey(blogId); if (blog != null) { int readCount = blog.getReadCount() + 1; blog.setReadCount(readCount); blogMapper.updateByPrimaryKeySelective(blog); return readCount; } return 0; } ... } ``` ### 1.2 在博客页面添加底部的版权声明 接下来,我们将在博客页面底部添加一个版权声明。具体的实现方式为: 1. 在博客页面底部添加一个版权声明的区域。 2. 在加载博客页面时,通过 AJAX 请求获取版权声明的内容,并更新版权声明区域的显示。 具体的代码实现如下: 在博客页面底部添加一个版权声明的区域: ```html <div class="blog-footer"> <div><span id="copyright"> 版权声明:本博客所有文章均为作者原创或转载,未经授权禁止转载。 </span></div> </div> ``` 在加载博客页面时,通过 AJAX 请求获取版权声明的内容,并更新版权声明区域的显示。具体的实现方式为: ```javascript $(function () { // 加载版权声明 $.ajax({ url: "/blog/copyright", type: "GET", success: function (result) { if (result && result.success) { $("#copyright") .html("版权声明:" + result.data); } } }); }); ``` 在服务器端,我们需要实现一个接口来获取版权声明的内容。具体的实现方式为: ```java @RestController @RequestMapping("/blog") public class BlogController { ... /** * 获取版权声明的内容 * * @return 版权声明的内容 */ @GetMapping("/copyright") public Result<String> getCopyright() { String content = "本博客所有文章均为作者原创或转载,未经授权禁止转载。"; return Result.success(content); } ... } ``` ## 2. 拓展模块的集成和配置 在上一篇文章中,我们已经将博客系统的所有模块都整合到了一个工程中,因此我们可以通过添加一个 Maven 模块来实现拓展模块的开发,并将其整合到原有工程中。 具体的步骤如下: 1. 在项目根目录下创建一个新的 Maven 模块,命名为 `blog-ext`,并将其添加到工程中。 2. 在 `blog-ext` 模块中添加 `pom.xml` 文件,并添加依赖关系。 3. 在 `blog-ext` 模块中添加 Spring Boot 的配置文件 `application.yml`,并添加相关配置。 4. 在 `blog-ext` 模块中添加拓展模块的代码和资源文件。 ### 2.1 添加 Maven 模块 在项目根目录下创建一个新的 Maven 模块,命名为 `blog-ext`,并将其添加到工程中。具体的步骤如下: 1. 在项目根目录下创建一个新的 Maven 模块,命名为 `blog-ext`。 ```bash $ cd ~/workspace/springboot-blog $ mvn archetype:generate -DgroupId=com.waylau.spring.boot.blog \ -DartifactId=blog-ext -DarchetypeArtifactId=maven-archetype-quickstart \ -DinteractiveMode=false ``` 2. 将 `blog-ext` 模块添加到工程中。 ```xml <modules> <module>blog-api</module> <module>blog-service</module> <module>blog-web</module> <module>blog-ext</module> </modules> ``` ### 2.2 添加依赖关系 在 `blog-ext` 模块中添加 `pom.xml` 文件,并添加依赖关系。具体的依赖关系如下: ```xml <dependencies> <dependency> <groupId>com.waylau.spring.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>${spring.boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> <!-- 添加 Spring Web MVC 的依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!-- 添加 MyBatis 的依赖 --> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>${mybatis.boot.version}</version> </dependency> </dependencies> ``` ### 2.3 添加配置文件 在 `blog-ext` 模块中添加 Spring Boot 的配置文件 `application.yml`,并添加相关配置。具体的配置如下: ```yaml spring: datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://localhost:3306/blog?useSSL=false&useUnicode=true&characterEncoding=utf8 username: root password: root mvc: view: prefix: /templates/ suffix: .html resources: static-locations: classpath:/static/ ``` ### 2.4 添加拓展模块的代码和资源文件 在 `blog-ext` 模块中添加拓展模块的代码和资源文件。具体的步骤如下: 1. 在 `blog-ext` 模块中添加 `com.waylau.spring.boot.blog.ext` 包,并在该包下添加 `BlogExtApplication` 类。 ```java @SpringBootApplication(scanBasePackages = "com.waylau.spring.boot.blog.ext") public class BlogExtApplication { public static void main(String[] args) { SpringApplication.run(BlogExtApplication.class, args); } } ``` 2. 在 `blog-ext` 模块中添加 `resources` 目录,并在该目录下添加 `templates` 和 `static` 目录。 3. 在 `templates` 目录中添加 `read-count.html` 和 `copyright.html`。 ```html <!-- read-count.html --> <div class="blog-sidebar-item"> <div class="blog-sidebar-title">阅读量</div> <div class="blog-sidebar-content"> <span id="read-count">0</span> </div> </div> ``` ```html <!-- copyright.html --> <div class="blog-footer"> <div><span id="copyright"> 版权声明:本博客所有文章均为作者原创或转载,未经授权禁止转载。 </span></div> </div> ``` 4. 在 `static` 目录中添加 `js` 目录,并在该目录下添加 `read-count.js` 和 `copyright.js`。 ```javascript // read-count.js $(function () { // 统计阅读量 var blogId = $("#blogId").val(); $.ajax({ url: "/blog/read/" + blogId, type: "POST", success: function (result) { if (result && result.success) { $("#read-count").text(result.data); } else { $("#read-count").text(0); } } }); }); ``` ```javascript // copyright.js $(function () { // 加载版权声明 $.ajax({ url: "/blog/copyright", type: "GET", success: function (result) { if (result && result.success) { $("#copyright") .html("版权声明:" + result.data); } } }); }); ``` ## 3. 拓展模块的使用示例 在完成了拓展模块的开发和配置之后,我们需要将其与原有系统进行整合。具体的步骤如下: 1. 在原有系统中添加对拓展模块的依赖关系。 在 `blog-web` 模块的 `pom.xml` 文件中添加对 `blog-ext` 模块的依赖关系: ```xml <dependencies> ... <!-- 添加 blog-ext 的依赖 --> <dependency> <groupId>com.waylau.spring.boot.blog</groupId> <artifactId>blog-ext</artifactId> <version>${project.version}</version> </dependency> </dependencies> ``` 2. 在原有系统中添加拓展模块的使用示例。 在博客文章详情页面中添加一个阅读量的区域: ```html <!-- 添加阅读量的区域 --> <div th:replace="blog-ext :: read-count"></div> ``` 在博客页面底部添加一个版权声明的区域: ```html <!-- 添加版权声明的区域 --> <div th:replace="blog-ext :: copyright"></div> ``` 经过以上的步骤,我们就已经成功地将博客系统的拓展模块整合到了原有系统中。 ## 总结 本文介绍了如何实现 Spring Boot 的拓展模块,并将其与原有系统进行整合。在实际开发中,我们可以根据具体的需求来实现不同的拓展模块,并通过配置文件等方式将其整合到原有系统中。这种方式既提高了代码的可维护性,又方便了模块的扩展和升级。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值