java项目实战、pom.xml配置解释、pojo 普通java对象

目录

1、项目结构:

2、parent和modules标签

3、clean和package

4、dependencyManagement和dependencies依赖透传

5、packaging标签

6、将maven项目变成spring-boot

7、统一版本号


1、项目结构:

根据不同业务,进行模块拆分

层次分明 逻辑清晰,分工明确,解耦

或者

Controller

ContentController

AccountController

MallController

Service

ContentService

AccountService

MallService

Dao

ContentDao

AccountDao

MallDao

Spring-mvc(三层架构)

2、parent和modules标签

子项目通过parent标签,来指定主项目

父项目通过modules标签,来指定子项目

依赖的主项目

<parent>

<groupId>cn.tedu</groupId>

<artifactId>my_project_release01</artifactId>

<version>1.0-SNAPSHOT</version>

</parent>

3、clean和package

clean:将编译的target文件夹清空

package :将java代码编译成字节码,生成在target文件夹下

4、dependencyManagement和dependencies依赖透传

在dependencyManagement下定义的依赖项,子项目依赖的时候可以不写版本号

dependencyManagement的依赖,是不会依赖透传的

dependencies中的依赖是可以依赖透传的

5、packaging标签

<!--整合子项目,本身并不实现具体的业务逻辑-->

<packaging>pom</packaging>

6、将maven项目变成spring-boot

复制代码
 <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.5.0</version>
  </parent>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
  </dependencies>

7、统一版本号

复制代码
<!--  属性配置 这里就配置了版本号-->
  <properties>
    <mysql-connector-version>8.0.27</mysql-connector-version>
  </properties>

  <modules>
    <module>tmall-admin</module>
    <module>tmall-front</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>${mysql-connector-version}</version>
      </dependency>
    </dependencies>

  </dependencyManagement>

</project>

@Service;

对象实现 impl Ser 序列化接口

相关推荐
optimistic_chen几秒前
【AI Agent 全栈开发】提示词技巧(prompt)
java·人工智能·ai·prompt·agent
E_ICEBLUE2 分钟前
在 Java 中使用 Spire.PDF 合并 PDF 文档(含加密与压缩处理)
java·pdf
消失的旧时光-19433 分钟前
SQL 怎么学(工程实战总纲|用一套用户模型打穿全流程)
java·数据库·sql
白露与泡影5 分钟前
从区间锁到行锁:一次高并发写入死锁治理实战
java·开发语言
茗创科技7 分钟前
Nature Neuroscience | 脑网络架构如何平衡分布式神经回路之间的合作与竞争?
python·神经网络·matlab·脑网络
村口张大爷7 分钟前
01 — MVC 与 DDD 的思维差异
java·后端
小短腿的代码世界7 分钟前
VLC-Qt深度解析:Qt应用中的专业视频播放方案
开发语言·qt
abc123456sdggfd7 分钟前
如何统一SQL视图报错信息_使用异常处理机制包装视图
jvm·数据库·python
qq_460978408 分钟前
如何处理SQL循环逻辑_探索递归CTE实现复杂计算
jvm·数据库·python
码农阿豪8 分钟前
Django接金仓数据库:我踩过的坑和填坑指南
数据库·python·django