无法使用 application.yml 文件更改端口,但可以在 application.properties 中使用

Can´t change port with application.yml file, but it works in application.properties

在 Spring 引导应用程序中,当我更改我的服务器端口时 application.properties

server.port=9001

它工作得很好。 但是当我尝试使用 application.yml

server:
  port : 9001

端口保持为8080。 我使用日食。可能是什么问题?

Spring Documentation

The SpringApplication class will automatically support YAML as an alternative to properties whenever you have the SnakeYAML library on your classpath.

你的类路径中有 SnakeYAML 吗?