spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration 转成yml格式
时间: 2023-08-23 09:33:40 浏览: 205
可以将属性文件(application.properties)中的属性转换成YAML格式(application.yml)的属性。
将该属性转换成YAML格式的方式如下:
```yaml
spring:
autoconfigure:
exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
```
在YAML中,使用冒号代替等号,使用缩进表示层级关系。所以,这个属性在YAML中的表示方式是将它转成一个嵌套的键值对。
相关问题
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.websocket.servlet.TomcatWebSocketServletAutoConfiguration
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.websocket.servlet.TomcatWebSocketServletAutoConfiguration是Spring Boot中的一个配置属性,用于排除Tomcat WebSocket Servlet的自动配置。
Tomcat WebSocket Servlet是Spring Boot中用于支持WebSocket协议的Servlet。在某些情况下,我们可能不需要使用WebSocket,或者我们希望使用其他的WebSocket实现。通过配置spring.autoconfigure.exclude属性,我们可以排除TomcatWebSocketServletAutoConfiguration的自动配置,从而禁用Tomcat WebSocket Servlet。
这个配置属性可以在application.properties或application.yml文件中进行配置,例如:
application.properties:
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.websocket.servlet.TomcatWebSocketServletAutoConfiguration
application.yml:
spring:
autoconfigure:
exclude: org.springframework.boot.autoconfigure.websocket.servlet.TomcatWebSocketServletAutoConfiguration
这样配置之后,Spring Boot将不会自动配置Tomcat WebSocket Servlet,从而达到禁用的效果。
spring: autoconfigure: exclude: org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
Spring Boot的`DataSourceAutoConfiguration`自动配置模块会管理数据库连接池,如果你不希望它自动配置,可以在`spring.factories`文件中(通常是类路径下的META-INF/spring.factories)添加一条排除规则,比如:
```properties
org.springframework.boot.autoconfigure.exclude=
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
```
或者在application.properties或application.yml文件中使用YAML格式:
```yaml
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
```
这样,Spring Boot就不会尝试去自动配置JDBC数据源,你需要手动导入并配置相关的依赖和配置。
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)