Spring Boot: how to to Load Configuration Properties from YAML File with Profiles
I'm a bit lost with I'm working with an scenario with loading configuration properties from a YAML file when using Spring Boot with profiles..... I have a `application.yml` file structured as follows: ```yaml spring: profiles: active: dev --- dev: datasource: url: jdbc:mysql://localhost:3306/dev_db username: dev_user password: dev_password --- prod: datasource: url: jdbc:mysql://localhost:3306/prod_db username: prod_user password: prod_password ``` I expect that when I run my application with the `dev` profile, it will pick up the configurations under the `dev` section. However, when I run the application, I get the following behavior message: ``` behavior starting ApplicationContext. Unable to start web server; nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.datasource' to javax.sql.DataSource ``` I have tried explicitly setting the active profile in both `application.properties` and `application.yml` but to no avail. Additionally, I verified that my dependencies in `pom.xml` are correct and up to date with Spring Boot 2.5.4. Here's my dependency section: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> ``` Additionally, I ensured that my YAML indentation is correct as improper indentation was previously causing issues in other parts of the application. I have also attempted to run the application without specifying the `spring.profiles.active` property in the command line, but the behavior continues with the same message. Could someone guide to understand why the Spring Boot application is unable to load the configuration properties from the YAML file, and how I could resolve this scenario? This is for a desktop app running on CentOS. Is there a simpler solution I'm overlooking? The stack includes Java and several other technologies. I'd be grateful for any help.