spring_reference/IX. ‘How-to’ guides/63.1. Externalize the confi...

9 lines
540 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

### 63.1. 外部化SpringApplication配置
SpringApplication已经被属性化主要是setters所以你可以在创建应用时使用它的Java API修改它的行为。或者你可以使用properties文件中的`spring.main.*`来外部化(在应用代码外配置)这些配置。比如,在`application.properties`中可能会有以下内容:
```java
spring.main.web_environment=false
spring.main.show_banner=false
```
然后Spring Boot在启动时将不会显示banner并且该应用也不是一个web应用。