Tag Archives: org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found character ‘@’

[Solved] org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found character ‘@’

1. Question


Running the springboot project encountered the following error

org.yaml.snakeyaml.scanner.ScannerException: while scanning for the next token found character ‘@’.

This is because I configured it in POM.XML

<profiles>
		<profile>
			<id>dev</id>
			<properties>
				<env>dev</env>
				<mysql.host>172.30.254.12</mysql.host>
				<mysql.port>3306</mysql.port>
				<mysql.user>root</mysql.user>
				<mysql.password>123456</mysql.password>
			</properties>
		</profile>
</profiles>

Then, I want to get the mysql.host attribute configured in the profile through% MySQL. Host% in application.yml.

However, when the project is started, the above error is reported.

2. Solution


After searching the Internet, it is true that some people have encountered similar problems. In his article, he said that Maven reimport can solve them.

The following is the step of Maven reimport. After following this step, the project can start smoothly.

Intellj’s function of automatically loading Maven POM is sometimes very easy to use, but sometimes many problems will be encountered, resulting in POM file modification without triggering automatic rewriting loading. At this time, you need to manually force the update of dependencies:

Manually delete the libraries package in project setting

Click the clean function in the project lifecycle in the Maven window to delete the previously compiled files

Right click the item — Maven — reimport