Spring Boot Quiz - MCQ - Multiple Choice Questions
Q. For the following spring boot code
@SpringBootApplication
public class MyApp {
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/mydb");
dataSource.setUsername("root");
dataSource.setPassword("password");
return dataSource;
}
@Bean
public JdbcTemplate jdbcTemplate(DataSource dataSource) {
return new JdbcTemplate(dataSource);
}
@Autowired
private JdbcTemplate jdbcTemplate;
// Rest of the application code...
}
Q. What is Spring Initializer primarily used for?
Q. Which of the following is true about Spring Security?
Q. Which of the following statements is true about Spring AOP (Aspect-Oriented Programming)?
Q. Which of the following statements is true about Spring Database integration?
Q. Which of the following is true about Spring Boot?
Q. Which Spring Boot annotation marks the main application class?
Q. Which statement about the @Autowired annotation in Spring Boot is true?
Q. Which code snippet shows the correct Spring Boot REST Controller configuration?