1. Configure date formatting

  • Receive Date Type Parameter Configuration (Required by the Web)
    spring.mvc.format.date=yyyy-MM-dd
    Copy the code
  • Return date type formatting configuration (JSON required)
    spring.jackson.date-format=yyyy-MM-dd
    Copy the code
  • Configure the time zone
    spring.jackson.time-zone=GMT+8
    Copy the code

2. Log Settings

  • Setting up log files
    logging.file=d://app.log
    Copy the code
  • Set the overall log level
    logging.level.root=TRACE, DEBUG, INFO, WARN, and ERROR
    Copy the code
  • Set the log level by package name
    Logging. Level. The package name=TRACE, DEBUG, INFO, WARN, and ERROR
    Copy the code

3. Multiple Eureka nodes are deployed

---------------------------peer1------------------------------
 server:
   port: 8761
 eureka:
   instance:
     hostname: peer1
     preferIpAddress: false
   client:
     registerWithEureka: true
     fetchRegistry: true
     serviceUrl:
       defaultZone: http://peer1:8761/eureka/,http://peer2:8762/eureka/
   server:
     enable-self-preservation: False # Disable self-protection
     eviction-interval-timer-in-ms: Set the cleaning interval to 60000 by default
 spring:
   application:
     name: eureka
Copy the code
 ---------------------------peer2------------------------------
  server:
    port: 8762
  eureka:
    instance:
      hostname: peer2
      preferIpAddress: false
    client:
      registerWithEureka: true
      fetchRegistry: true
      serviceUrl:
        defaultZone: http://peer1:8761/eureka/,http://peer2:8762/eureka/
    server:
      enable-self-preservation: False # Disable self-protection
      eviction-interval-timer-in-ms: Set the cleaning interval to 60000 by default
  spring:
    application:
      name: eureka
Copy the code
Note: defaultZone must look like the above configuration; otherwise, the available-replicas entry will be empty.

4. Customize load balancing rules

inheritance