Failed to bind properties under'spring.datasource' to javax.sql.DataSource:

Failed to bind properties under'spring.datasource' to javax.sql.DataSource:

When springboot integrates druid, the data source of druid is introduced, and the relevant configuration is configured in the configuration file application.yml

spring:
  datasource:
    username: root
    password: 123456
    url: jdbc:mysql://192.168.2.218:3306/test
    driver-class-name: com.mysql.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource

    initialSize: 5
    minIdle: 5
    maxActive: 20
    maxWait: 60000
    timeBetweenEvictionRunsMillis: 60000
    minEvictableIdleTimeMillis: 300000
    validationQuery: SELECT 1 FROM DUAL
    testWhileIdle: true
    testOnBorrow: false
    testOnReturn: false
    poolPreparedStatements: true
#    filters sql 'wall' 
    filters: stat,wall,log4j
    maxPoolPreparedStatementPerConnectionSize: 20
    useGlobalDataSourceStat: true
    connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
    schema:
      - classpath:department.sql
 

But an error is reported at startup:

According to the error message: check the configuration file, the line of code is filters: stat,wall,log4j

See the reason for the error: org.apache.log4j.Logger, so I guessed that log4j related dependencies were missing, and related dependencies were introduced in the pom.

<!-- https://mvnrepository.com/artifact/log4j/log4j -->
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.17</version>
		</dependency>
 

Start again, success!