In springboot profile uses 1

1. expression: application.properties or application.yml, which was already agreed upon as vulgar file, do not modify the file name, file to configure the global file.

2. syntax: yml or yaml.

  . A basic syntax:

   k :( space) v  : designates a pair of key-value pairs (there must be a space);

   Whitespace indentation to control the level of relations, as long as one is left-aligned data, are of the same level; such as:

    server:

      port: 8081

      path: /hello

  And attribute values are case sensitive ;

  . B worth writing:

   Literal: Common values ​​(numbers, strings, Boolean)

    k: v: literally write directly to:

        String Default not in single or double quotes;

        "": Double quotes: there will not escape the string of special characters; special characters as themselves want to express the meaning of

          name: "zhangsan \ n lishi" Output: zhangsan wrap lisi

        '': Single quote: YES escape special characters, special characters finally just an ordinary string data

          name: 'zhangsan \ n lisi' Output: zhangsan \ n lisi

        Default does not use quotation marks, the string can be written in multiple lines start from the second row, there must be a single space indent . Line breaks will be converted to spaces

   Object, Map (attributes and values) (key-value pairs):

    The relationship between attributes and values ​​of an object to write the next line:: k: v Note indent

      Object or k: v way

        friends:

          lastName: zhangsan

          age: 20

    Inline wording:

        friends: {lastName: zhangsan,age: 20}

   Array (List, Set):

    It represents an element in the array of values (- with a note indentation, space )

        pets:

         - cat

         - dog

         - pig

    Inline wording :( note the space)

        pets: [cat,dog,pig]

3. The data configuration files, configuration and injected into the class :( lastName property javaBean class in the configuration file can be written last-name as the default springboot - after the first letter in uppercase )

4. Use of the unit tests springboot

 

Guess you like

Origin www.cnblogs.com/ysq0908/p/11140931.html