server.port=8888
spring.profiles.active=test
server.servlet.context-path=/ysd
##学生类自定义属性 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=zhengzhou
-------------------------------
@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>
<!-- 热部署 --> <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>
转载于:https://www.cnblogs.com/fhsy/p/11460652.html