SpringBoot 1.x configure it

1 profiles

1.1 SpringBoot uses a global configuration file

  • application.properties。
  • application.yml.

1.2 configuration file location

  • Profile stored in src / main / resources directory or classpath / config.

1.3 What is .yml file

  • .yml language is YAML file, data-centric than JSON, XML and so more suitable for the configuration file.

1.4 Role of the global configuration file

  • Global configuration file can modify some of the default configuration values.

 

2 YAML syntax

2.1 The basic syntax

  • Use indention hierarchy.
  • Indent when allowed to use the tab key, only allowing the use of space.
  • The number of spaces to indent does not matter, as long as the left elements are aligned to the same level.
  • Case Sensitive.

 

  • Example:
server:
  port: 8081

Guess you like

Origin www.cnblogs.com/xuweiweiwoaini/p/12219317.html