application.properties and application-dev.properties files, and the active profile set to dev, what will be the value of the property app.message if application.properties has app.message=Hello from default and application-dev.properties has app.message=Hello from dev?When a profile is active, Spring Boot loads application.properties first, then overrides with application-{profile}.properties. So app.message from application-dev.properties replaces the default.
test profile is active?The @Profile annotation requires the profile name as a string in double quotes. Option D uses the correct syntax.
application.properties and application-prod.properties. They set spring.profiles.active=prod in application.properties. But the properties from application-prod.properties are not loaded at runtime. What is the most likely cause?application.properties can cause loading order issues.Setting spring.profiles.active inside application.properties can cause Spring Boot to load properties incorrectly because it reads application.properties before knowing the active profile. It is recommended to set active profiles via command-line or environment variables.
dev and qa. There are two beans defined with @Profile("dev") and @Profile("qa") respectively. What happens when the app starts?When multiple profiles are active, Spring Boot loads beans for all active profiles. So both beans annotated with @Profile("dev") and @Profile("qa") will be created.
application.properties, application-dev.properties, and application-local.properties, and you activate both dev and local profiles, which property file has the highest precedence when properties conflict?spring.profiles.active affects property overriding.When multiple profiles are active, Spring Boot loads application.properties first, then profile-specific files in the order they appear in spring.profiles.active. Later profiles override earlier ones.