关于springboot:Spring-Boot学习一父子项目图标配置文件

6次阅读

共计 1167 个字符,预计需要花费 3 分钟才能阅读完成。

1、创立父子我的项目

1、须要在父我的项目 pom.xml 文件增加
    <packaging>pom</packaging>
2、须要在子项目中更改
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.6</version>
        <relativePath/>
更改为父我的项目的
    <groupId>com.jc</groupId>
    <artifactId>springboot_parent</artifactId>
    <version>0.0.1-SNAPSHOT</version>

子项目中替换

2、spring boot 图标替换

springboot 图标生成器:https://www.bootschool.net/ascii
把 banner.txt 文件放在 resources 配置包下(会主动读取 banner.txt)

能够设置敞开图标 SpringApplication 启动类配置

@SpringBootApplication
public class Springboot01Application {public static void main(String[] args) {SpringApplication app = new SpringApplication(Springboot01Application.class);
//        app.setBannerMode(Banner.Mode.OFF);         // 能够设置敞开 springboot 横幅
        app.run(args);
    }

}

3、配置文件

# 1、application.properties    K/ v 构造
# 端口号
server.port=1313
# 前缀:localhost:1313/lll/hello
server.servlet.context-path=/lll

# 2、application.yml            树形构造
server:
    prot: 1313

application.yaml

配置文件的加载程序

 优先读取,后读取的补充(父配置优先 -> 子配置)<includes>
    <include>**/application*.yml</include>
    <include>**/application*.yaml</include>
    <include>**/application*.properties</include>
  </includes>

4、多个 profile 文件

Spring 官网语法:application-xxx.properties(.yaml/yml)

spring.profiles.active=dev

 不要混合应用配置文件(yml、yaml、properties),保持只是用其中之一。

正文完
 0