MCQ: What is the role of the @Profile annotation in Spring Boot?
a) To enable Aspect-Oriented Programming
b) To configure application security
c) To define scheduled tasks
d) To specify beans for specific profiles
Answer:
d) To specify beans for specific profiles
Explanation:
The @Profile annotation in Spring Boot is used to specify that a bean should only be active in a specific profile, allowing for conditional bean registration based on the active environment.
More 100+ Spring Boot MCQ Questions and Answers
- What is the primary goal of Spring Boot?
- Which version of Java is required for Spring Boot 3?
- What is the role of @SpringBootApplication annotation in Spring Boot?
- What is the purpose of Spring Boot Starters?
- Which embedded servlet container is NOT supported by default in Spring Boot?
- How does Spring Boot simplify Maven configuration?
- Which version of Gradle is compatible with Spring Boot 3
- What is the purpose of Spring Boot Actuator?
- What is the default port for a web application in Spring Boot?
- How can you customize the banner in a Spring Boot application?
- What is the purpose of the spring-boot-starter-web dependency?
- Which component in Spring Boot auto-configures a DataSource based on the classpath settings?
- What is the purpose of the spring-boot-starter-test dependency?
- Which embedded servlet container is supported by default in Spring Boot?
- How can you run a Spring Boot application?
- What is the use of the @ComponentScan annotation in Spring Boot?
- What does the @Autowired annotation do in Spring Boot?
- What is the use of @Entity annotation in Spring Boot?
- What is the use of the spring-boot-starter-data-jpa dependency?
- What is the use of @SpringBootTest annotation in Spring Boot?
- What is the use of the @ConfigurationProperties annotation in Spring Boot?
- Which dependency is used to configure Spring Security in Spring Boot?
- How does Spring Boot support database migrations?
- What is the default scope of a Spring bean in Spring Boot?
- What is the use of the @Service annotation in Spring Boot?
- What is the role of the spring-boot-starter-actuator dependency?
- How can you specify profile-specific configuration in Spring Boot?
- What is the purpose of the @Scheduled annotation in Spring Boot?
- How does Spring Boot simplify database access?
- What is the use of @RequestBody annotation in a Spring Boot controller?
- How are static resources served in a Spring Boot web application?
- What is the use of the @Query annotation in Spring Data JPA?
- What is the purpose of the @EnableAutoConfiguration annotation in Spring Boot
- How to secure REST endpoints in Spring Boot?
- What is the purpose of the @JsonBackReference and @JsonManagedReference annotations in Spring Boot?
- What is the use of the @CrossOrigin annotation in a Spring Boot application?
- In Spring Boot, how can you externalize configuration?
- What is the purpose of the @PathVariable annotation in Spring Boot?
- Which component is responsible for handling view resolution in a Spring Boot web application?
- How can you enable transaction management in a Spring Boot application?
- What is the primary use of the @Repository annotation in Spring Boot?
- What is the purpose of the spring-boot-starter-jdbc dependency in Spring Boot.
- What is the purpose of the spring-boot-starter-aop dependency?
- What is the primary role of the spring-boot-starter-cache dependency?
- How can you handle exceptions globally in a Spring Boot application?
- What is the main purpose of the @EnableJpaRepositories annotation in Spring Boot?
- What is the role of the @Valid annotation in Spring Boot?
- How to implement internationalization (i18n) in Spring Boot?
- What is the use of @ModelAttribute annotation in a Spring Boot web application?
- Which starter dependency is used for developing web applications with Thymeleaf templates in Spring Boot?
- How does Spring Boot support the creation of JMS (Java Message Service) applications?
- What is the use of @JsonInclude annotation in Spring Boot?
- What is the role of the @Profile annotation in Spring Boot?
- How does Spring Boot handle logging?
- What is the use of spring-boot-starter-data-mongodb dependency?
- In Spring Boot, how is a bean defined?
- What is the role of the @RequestParam annotation in a Spring Boot web application?
- In Spring Boot, what is the purpose of the @EnableCaching annotation?
- What is the primary use of the @JsonView annotation in Spring Boot?
- What is the role of the spring-boot-starter-websocket dependency?
- In Spring Boot, which annotation is used to create asynchronous methods?
- What is the primary purpose of the @EnableJpaAuditing annotation in Spring Boot?
- How does Spring Boot support OAuth2 for securing applications?
- In Spring Boot, what is the purpose of the @ExceptionHandler annotation?
- What is the primary use of the @Transactional annotation in Spring Boot?
- How does Spring Boot simplify the deployment of web applications?
- What is the use of @RestController in Spring Boot
- How does Spring Boot simplify the development of web applications?
- What is the use of @RequestMapping annotation in Spring Boot?
- What is the use of @ResponseBody annotation in a Spring Boot controller?
- In Spring Boot, how can you handle exceptions globally?
- How does Spring Boot support form handling in web applications?
- How can you define custom error pages in a Spring Boot web application?
- What is the use of @RestControllerAdvice annotation in Spring Boot?
- How can you define custom HTTP error codes in a Spring Boot application?
- What is the use of @JsonIgnore annotation in Spring Boot?
- In Spring Boot, how can you customize the default JSON serializer?
- How can you serve a dynamic HTML content in a Spring Boot application?
- Which Spring Boot starter dependency is used for JPA integrations?
- How does Spring Boot automatically configure a DataSource?
- Which Spring Boot starter is used for integrating the MongoDB NoSQL database?
- In Spring Boot, how can you access the H2 database's web console in development?
- In Spring Boot, which annotation is used to define SQL queries in repository interfaces?
- How can you define a JPA repository in Spring Boot?
- What is the role of the JpaRepository interface in Spring Boot?
- Which Spring Boot starter is used for integrating the Elasticsearch NoSQL database?
- What is the purpose of the @GeneratedValue annotation in a JPA entity?
- How does Spring Boot support Redis caching?
- What is the use of MongoRepository interface in Spring Boot?
- How to enable automatic schema generation for JPA entities in Spring Boot?
- What is the use of @Table annotation in a JPA entity?
- Which Spring Boot starter is used for integrating Apache Cassandra?
- What is the primary use of the @ManyToOne annotation in JPA?
- How can you define custom query methods in a Spring Data repository?
- What is the use of @OneToOne annotation in JPA?
- What is the primary use of the @OneToMany annotation in JPA?
- What is the role of the @Version annotation in a JPA entity?
- How does Spring Boot simplify the integration with Apache Kafka?
- What is the use of @Lob annotation in a JPA entity?
- How does Spring Boot support reactive data access?
- In Spring Boot, which annotation is used for declarative transaction management?
MCQ
Spring Boot
Comments
Post a Comment