server.port=8888java
spring.profiles.active=testspring
server.servlet.context-path=/ysdapp
##學生類自定義屬性
student.name=Tom
student.age=22
student.birthday=1996/01/10
student.sex=true
student.hobbies[0]=swimming
student.hobbies[1]=basketball
student.skills[0]=programming
student.skills[1]=test
student.address.province=henan
student.address.city=zhengzhoumaven
-------------------------------spring-boot
@Component 類註解
@ConfigurationProperties(prefix="student") 配置文件前綴 需跟類名相同
@PropertySource({"classpath:stu.properties"}) 配置文件路徑測試
<!-- 項目設置 : 編碼格式 UTF-8 -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>ui
<!-- 熱部署 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- optional=true, 依賴不會傳遞,該項目依賴 devtools ;以後依賴 myboot 項目的項目若是想要使用 devtools ,須要從新引入 -->
<scope>true</scope><!-- 熱部署 -->
</dependency>編碼
<build>
<plugins>
<!-- SpringBoot插件 -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<!-- SpringBoot項目打包jar名稱 -->
<finalName>demo</finalName>
</build>spa