SpringBoot注解配置文件自动映射到属性和实体类
- Controller上面配置
@Component
@PropertySource({"classpath:application.properties"})
@ConfigurationProperties
- 属性上面配置
@Value("${test.name}")
2024-03-16 18:35:46
@Component
@PropertySource({"classpath:application.properties"})
@ConfigurationProperties
@Value("${test.name}")