摘要:本文通过讲解如何解析application.properties属性,介绍了几个注解的运用@Value @ConfigurationProperties @EnableConfigurationProperties @Autowired @ConditionalOnProperty
1 准备
1.1 搭建springboot
1.2 写一个controller类
package com.gbm.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; /** * Created by Administrator on 2019/2/20. */ @Controller public class IndexController { @RequestMapping("/index") @ResponseBody public String index() { return "我爱北京天安门!"; } }