摘要:本文通过讲解如何解析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 "我爱北京天安门!";
    }
}
View Code

相关文章:

  • 2022-12-23
  • 2021-06-06
  • 2021-07-28
  • 2021-11-24
  • 2022-01-12
  • 2021-11-23
猜你喜欢
  • 2021-11-23
  • 2022-01-10
  • 2022-12-23
  • 2021-10-16
  • 2021-04-17
  • 2021-04-06
相关资源
相似解决方案