springboot配置
时间: 2023-06-28 14:11:49 浏览: 38
Spring Boot 配置主要是通过 application.properties 或 application.yml 文件来实现的。以下是一些基本的配置示例:
1. 配置端口号:
application.properties:
```
server.port=8080
```
application.yml:
```
server:
port: 8080
```
2. 配置数据库:
application.properties:
```
spring.datasource.url=jdbc:mysql://localhost:3306/db_name
spring.datasource.username=root
spring.datasource.password=root
```
application.yml:
```
spring:
datasource:
url: jdbc:mysql://localhost:3306/db_name
username: root
password: root
```
3. 配置日志:
application.properties:
```
logging.level.root=info
```
application.yml:
```
logging:
level:
root: info
```
这些只是配置的一些基本示例,更多的配置可以参考官方文档:https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html