How can a custom auto-configuration be created in Spring Boot?
- By defining a class annotated with @SpringBootApplication.
- By using the @EnableAutoConfiguration annotation.
- By creating a class with @Configuration and @ConditionalOnClass annotations.
- By specifying properties in the application.properties file.
In Spring Boot, you can create custom auto-configurations by defining a class with the @Configuration annotation and using the @ConditionalOnClass annotation to conditionally enable the configuration based on the presence of specific classes. This allows you to control when your custom auto-configuration should be applied. The other options do not directly relate to creating custom auto-configurations in Spring Boot.
Loading...
Related Quiz
- In Spring Boot, how do you configure the TestRestTemplate to work with a specific profile during integration testing?
- In Spring Security, how would you handle the situation where a user needs multiple roles for accessing different resources?
- In Spring Boot, using the _____ annotation in test classes allows selectively enabling parts of the application context, making tests more focused and faster.
- In Spring Cloud, how can you enable a service to register itself with Eureka Server?
- What considerations should be taken into account when designing API endpoints using Request Mapping annotations in Spring Boot?