• notice
  • Congratulations on the launch of the Sought Tech site

application.yml Common Basic Configuration

foreword

In normal project development, I am more familiar with the writing method of application.yml configuration. Now I summarize the commonly used configuration of application.yml as follows:

1.Tomcat configuration

server:
  #Set request port
    port: 8080
    servlet:
  #Specify Tomcat's request path
      context-path: /cl #Set
  Tomcat encoding format
      encoding:
        charset: UTF-8

2. mybatis configuration

mybatis:
    #Load the mapper.xml file into the container
    mapper-locations: classpath:mapper/*.xml
    #Alias, simplify the request response parameter type in mapper.xml
    type-aliases-package: com.cl.springboot.pojo
    configuration:
    # Turn on the hump mapping
    map-underscore-to-camel-case: true
    # print the sql log
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

3. Log settings (can print the executed SQL statement)

record:
    level:
      com.cl.springboot: #Specify
            to print the log of the corresponding folder, and set the level of the printed log (com.cl.springboot.mapper package)
            mapper: debug
    file:
  #Specify the location where the log file is generated
      name: D:/spring.log

4. Data source configuration

spring:
   datasource:
     #mysql configuration loading driver class information
     driver-class-name: com.mysql.jdbc.Driver
     #mysql connection information
     url: jdbc:mysql://localhost:3306/mybatis?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&serverTimezone = GMT #User
     name
     username: root
 #Password password
     : 123456
     # Type Set which type of data source to use
     type: com.alibaba.druid.pool.DruidDataSource
   #redis configuration
   redis:
     database: 0
     # Redis server Address
     host: 127.0.0.1
     # Redis server connection port
     port: 6379
     # Redis server connection password (default is empty)
     password:
     jedis:
       pool:

    # The maximum number of connections in the connection pool (use a negative value to indicate no limit)
         max-active: 8
     # The maximum blocking waiting time of the connection pool (use a negative value to indicate no limit)
         max-wait: -1
     # The maximum idle connection in the connection pool
         max-idle: 8
     # The minimum idle connection in the connection pool
         min-idle: 0
     # The connection timeout (milliseconds) defaults to
 2000ms timeout:
     2000ms #Druid data source attribute configuration (you need to create a data source configuration class, and the configuration will take effect)
     initialSize: 5
     minIdle: 5
     maxActive: 20
     maxWait: 60000
     timeBetweenEvictionRunsMillis: 60000
     minEvictableIdleTimeMillis: 300000
     validationQuery: SELECT 1 FROM DUAL
     testWhileIdle: true
     testOnBorrow: false
     testOnReturn:
     falsetrueStates poolpar:

    # Configure the filters for monitoring and statistics interception. After removal, the monitoring interface sql
 cannot be counted. 'wall' is used for the firewall


Tags

Technical otaku

Sought technology together

Related Topic

1 Comments

author

cheap lipitor 40mg & lt;a href="https://lipiws.top/"& gt;buy atorvastatin 40mg for sale& lt;/a& gt; buy lipitor

Kfdvhp

2024-03-10

Leave a Reply

+