springboot 2.0.5.RELEASE单元测试例子
springboot版本:2.0.5.RELEASE jdk:1.8 目标,根据一个properties文件获取内容,并添加到对象上。并通过springboot单元测试 在esources根目录下添加other.properties文件 other.properties内容 other.title=burns other.blog=http://zhongyuele.top/ 在com.esoon.ids.entity包中创建OtherProperties类 OtherProperties.java package com.esoon.ids.entity; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; @Component @Data @ConfigurationProperties(prefix = "other") @PropertySource(("classpath:other.properties"))