import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; @Configuration
@ConditionalOnWebApplication//web应用才生效
@EnableConfigurationProperties(HelloProperties.class)
@ConditionalOnClass(HelloService.class)
public class HelloServiceAutoConfiguration {
@Autowired
HelloProperties helloProperties;
@Bean
public HelloService helloService(){
HelloService service = new HelloService();
service.setHelloProperties(helloProperties);
return service;
}
}

在方法helloService上加@Bean标签

最新文章

  1. eclipse SE增加Web开发插件
  2. Apache+PHP 配置随笔
  3. 【BZOJ-1692&1640】队列变换 后缀数组 + 贪心
  4. hdu 1022 Train Problem I 解题报告
  5. codevs 1171 潜伏者
  6. 更改yum网易 阿里云的yum源。
  7. 每天一个Linux命令(08)--cp命令
  8. Java 9 尝鲜之JShell交互式编程环境
  9. CS:APP3e 深入理解计算机系统_3e Y86-64模拟器指南
  10. Dictionary排序
  11. select下拉框左右变换
  12. 【Java集合的详细研究4】Java中如何遍历Map对象的4种方法
  13. Debian 9 源配置
  14. js-学习笔记-Thunk函数
  15. LeetCode题解之 Implement strStr()
  16. 详解Linux(centos7)下安装OpenSSL安装图文方法
  17. ABP框架入门踩坑-使用MySQL
  18. oracle 网络配置 及 pl/sql 连接配置
  19. 小程序swiper 快速滑动闪屏
  20. 「COCI2016/2017 Contest #2」Bruza

热门文章

  1. 【Spring-Security】Re01 入门上手
  2. Flink-v1.12官方网站翻译-P003-Real Time Reporting with the Table API
  3. [WPF 学习] 18. 摄像头(肢解DirectShow)
  4. 2019 ICPC 上海区域赛总结
  5. 基于CentOS-7的redis下载和安装
  6. 梨子带你刷burp练兵场(burp Academy) - 服务端篇 - Sql注入配套漏洞讲解笔记
  7. OpenStack Train版-9.安装neutron网络服务(计算节点)
  8. msf 信息收集
  9. 事件循环 EventLoop(Promise,setTimeOut,async/await执行顺序)
  10. cheerio & jQuery for server