spring boot 自动化配置示例

This commit is contained in:
YunaiV
2020-02-02 14:07:56 +08:00
parent cea438c986
commit 036a8610c9
3 changed files with 6 additions and 2 deletions

View File

@@ -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) 。

View File

@@ -1,3 +1,3 @@
yunai:
server:
port: 8888
port: 8888 # 自定义 HttpServer 端口

View File

@@ -15,7 +15,7 @@ import java.net.InetSocketAddress;
@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 自带,所以一定成立。