springboot自定义springbootstart,测试读取application.yml文自定义属性的内容

本文介绍了如何创建一个SpringBoot Starter,并详细说明了创建过程,包括新建项目、配置类、读取配置类和配置注解的创建。此外,还展示了如何在其他项目中引入并测试使用该Starter,实现配置文件的自动补全和内容读取。
摘要由CSDN通过智能技术生成

springboot自定义springbootstart

1.前言

本文主要是介绍springboot如何创建springboot start,并且引入dependency使用

主要是通过读取配置文件的内容,并且使idea写我们自定的配置文件时有提示,自动补全功能,更容易去理解springboot start封装的内容

2.创建springboot start

2.1.新建项目read-properties-springboot-start

1.在pom.xml引入springboot依赖的parent,以及自定义start依赖

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.tianma</groupId>
    <artifactId>read-properties-springboot-start</artifactId>
    <version>1.0-SNAPSHOT</version>

    <!--引入springboot启动依赖的paren-->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent<
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值