Spring Boot Profiles - @Profile, application-{profile}.yml

    Question 1CORE SPRING BOOT - Purpose of Profiles

    What is the main purpose of using profiles in Spring Boot?

    Question 2CORE SPRING BOOT - @Profile Annotation

    Which of the following best describes the @Profile annotation?

    Question 3CORE SPRING BOOT - Activating Profiles

    How can you activate a Spring profile in a Spring Boot application?

    Question 4CORE SPRING BOOT - Profile-Specific YAML

    Which of the following is a correct way to define a profile-specific configuration in YAML?

    Question 5CORE SPRING BOOT - Code Snippet (@Profile)

    What will happen when this code runs with the "dev" profile active?

    @Component @Profile("dev") public class DevDatabaseConfig implements DatabaseConfig {}

    Question 6CORE SPRING BOOT - Multiple Profiles in a Bean

    How can you make a bean active for multiple profiles?

    Question 7CORE SPRING BOOT - Code Snippet (Profile-Specific Property)

    Which value will be injected into port when the "prod" profile is active?

    server: port: 8080 --- spring: profiles: prod server: port: 9090 @Value("${server.port}") private int port;

    Question 8CORE SPRING BOOT - Default Profile

    What is the default profile in Spring Boot if no profile is explicitly activated?

    Question 9CORE SPRING BOOT - Code Snippet (@Profile with Configuration)

    Consider the following configuration class:

    @Configuration @Profile("test") public class TestConfig { @Bean public String testBean() { return "Test Bean"; } }

    What happens when the "dev" profile is active?

    Question 10CORE SPRING BOOT - Best Practices with Profiles

    Which of the following is considered a best practice when using Spring Boot profiles?