pom.xml文件 和 resource/application.yaml文件

 pom.xml文件

在Java项目中,POM (Project Object Model) 文件是Maven项目管理工具中的核心文件之一。它是一个XML文件,通常命名为pom.xml,用于描述项目的基本信息、依赖关系、构建配置等。pom.xml 是spring boot项目“起步依赖”的文件。下面是pom.xml文件可能包含的一些内容:

1.项目基本信息:包括项目的groupId(项目组ID)、artifactId(项目唯一标识符)、version(项目版本)、name(项目名称)、description(项目描述)等。

<groupId>com.example</groupId>
<artifactId>my-project</artifactId>
<version>1.0.0</version>
<name>My Project</name>
<description>This is a sample Maven project.</description>

2.依赖管理:描述项目所依赖的外部库或模块。每个依赖项包括groupIdartifactIdversion等信息。

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>5.3.2</version>
    </dependency>
    <!-- Other dependencies -->
</dependencies>

3. 构建配置:描述项目如何构建的配置信息,例如编译器版本、源代码目录、资源目录、插件配置等。

<build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
        </resource>
    </resources>
    <!-- Plugin configurations -->
</build>

4.插件配置:配置Maven插件的参数,用于执行各种构建任务,如编译、测试、打包等

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <!-- Other plugins -->
    </plugins>
</build>

5.仓库配置:指定项目依赖项所在的Maven仓库,可以是本地仓库或远程仓库。

<repositories>
    <repository>
        <id>central</id>
        <url>https://repo.maven.apache.org/maven2</url>
    </repository>
    <!-- Other repositories -->
</repositories>

总的来说,pom.xml文件是Maven项目的核心配置文件,定义了项目的结构、依赖关系、构建过程等重要信息,使得Maven能够管理项目的构建、依赖和部署

 resource/application.yaml文件

配置文件,比如在pom.xml文件中引入了mybatis,mysql驱动,那么需要在application.yaml文件中配置信息:

mybatis:
  configuration:
    #开启驼峰映射后,会把数据库字段下划线格式映射为java实体类的驼峰格式,如果实体类属性也是下划线格式,那无法映射上
    map-underscore-to-camel-case: false
    cache-enabled: false #全局关闭缓存
    multiple-result-sets-enabled: true #是否允许单条sql 返回多个数据集
    use-column-label: true
    use-generated-keys: true
    auto-mapping-behavior: partial
    default-executor-type: simple

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值