Complete the code to activate the 'dev' profile in Spring Boot.
spring.profiles.active=[1]To activate the development profile, set spring.profiles.active to "dev".
Complete the annotation to specify a bean only for the 'prod' profile.
@Profile([1]) public class ProductionService {}
The @Profile annotation activates the bean only when the specified profile is active. Here, it should be "prod".
Complete the YAML to activate the 'test' profile.
spring:
profiles: [1]
datasource:
url: jdbc:h2:mem:testdbIn YAML, to activate a profile, use spring.profiles.active: test, which is indented as profiles: active: test under spring.
Fill the blank to define a bean that is active only for 'dev' and 'test' profiles.
@Profile([1]) public class DevTestService { // bean code }
Use a comma-separated list like @Profile({"dev", "test"}) to activate for multiple profiles. Multiple values imply OR logic.
Fill the blanks to create a properties file name for the 'prod' profile with YAML format.
application-[1].[2]
The file name for the production profile in YAML format is application-prod.yml or application-prod.yaml.