An error is reported when starting the Spring Boot project: mapping values are not allowed here

Problem Description

An error was reported when starting the Spring Boot project. It was fine when it was started before. I don’t know why it suddenly reported an error when starting this time mapping values are not allowed here, as follows:

insert image description here

Cause Analysis

It seems that there is a problem with the configuration file, and then I checked on the Internet and said that the format of the yml file is relatively strict, and there must be a space after each colon. Then I checked several times to make sure that there is a space after each colon. , I found the problem when I was puzzled:

insert image description here

solution

url, username, passwordshould be derver-class-nameat the same level as and, but it is assigned to derver-class-namethe next level, and it runs successfully after the change, as follows:

insert image description here

insert image description here

Summarize

When the project reports an error mapping values are not allowed here, there is a high probability that there is a problem with the configuration file. Observe the location of the guide when the error is reported. There may be two reasons for the error:

  1. There must be a space after the colon, otherwise an error will be reported;
  2. Note that attributes at the same level are placed on the same layer, and no more tabs are allowed;

Guess you like

Origin blog.csdn.net/apple_51673523/article/details/129474076