Complete the code to define a configuration property class with the correct annotation.
@[1]("app.settings") public class AppSettings { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
The @ConfigurationProperties annotation binds external properties to this class.
Complete the code to enable configuration properties scanning in the main application class.
@SpringBootApplication @[1](AppSettings.class) public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
The @EnableConfigurationProperties annotation tells Spring Boot to process the specified configuration properties class.
Fix the error in the configuration properties class by completing the missing annotation.
public class DatabaseConfig { private String url; public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } } @[1]("database") class DatabaseProperties extends DatabaseConfig {}
The subclass must be annotated with @ConfigurationProperties to bind properties with the prefix 'database'.
Fill both blanks to create a configuration properties class with a nested property and its getter.
import org.springframework.boot.context.properties.ConfigurationProperties; @[1]("server") public class ServerProperties { private Security security = new Security(); public Security getSecurity() { return [2]; } public static class Security { private boolean enabled; public boolean isEnabled() { return enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } } }
The class must be annotated with @ConfigurationProperties and the getter should return the field named security.
Fill all three blanks to create a configuration properties class with a list property and its setter.
import org.springframework.boot.context.properties.ConfigurationProperties; import java.util.List; @[1]("app") public class AppConfig { private List<String> [2]; public void set[3](List<String> values) { this.modules = values; } }
The class uses @ConfigurationProperties with prefix 'app'. The list field is named modules and the setter method is setModules.