Skip to content

Commit

Permalink
spring boot 自动化配置示例
Browse files Browse the repository at this point in the history
  • Loading branch information
YunaiV committed Feb 2, 2020
1 parent cea438c commit 036a861
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

让我们一起愉快的挖坑,挖深坑,哇哈哈。

## 打好基础

* [《芋道 Spring Boot 自动配置原理》](http://www.iocoder.cn/Spring-Boot/autoconfigure/?github) 对应 [lab-47](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-47)

## Web 开发

* [《芋道 Spring Boot SpringMVC 入门》](http://www.iocoder.cn/Spring-Boot/SpringMVC/?github) 对应 [lab-23](https://github.com/YunaiV/SpringBoot-Labs/tree/master/lab-23)
Expand Down
2 changes: 1 addition & 1 deletion lab-47/lab-47-demo/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
yunai:
server:
port: 8888
port: 8888 # 自定义 HttpServer 端口
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@EnableConfigurationProperties(YunaiServerProperties.class) // 使 YunaiServerProperties 配置属性类生效
public class YunaiServerAutoConfiguration {

private Logger logger = LoggerFactory.getLogger(getClass());
private Logger logger = LoggerFactory.getLogger(YunaiServerAutoConfiguration.class);

@Bean // 声明创建 Bean
@ConditionalOnClass(HttpServer.class) // 需要项目中存在 com.sun.net.httpserver.HttpServer 类。该类为 JDK 自带,所以一定成立。
Expand Down

0 comments on commit 036a861

Please sign in to comment.