mirror of
https://gitee.com/yudaocode/SpringBoot-Labs.git
synced 2026-09-03 05:53:54 +08:00
spring boot 自动化配置示例
This commit is contained in:
@@ -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) 。
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
yunai:
|
||||
server:
|
||||
port: 8888
|
||||
port: 8888 # 自定义 HttpServer 端口
|
||||
|
||||
@@ -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 自带,所以一定成立。
|
||||
|
||||
Reference in New Issue
Block a user