← All Spring Framework Flashcard Decks

Spring Framework Flashcards

25 cards from real Spring Framework practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.

Read the first 20 Spring Framework flashcards as text
  1. What is the meaning of spring?

    Answer: Spring is an open source development framework for enterprise Java.

    The Spring Framework is a widely adopted, open-source application framework specifically designed for the Java platform. It provides comprehensive infrastructure support for developing robust enterprise-level Java applications, offering features like dependency injection, aspect-oriented programming, and integration with various technologies to simplify development.

  2. Spring is licensed under a

    Answer: Apache License 2.0

    The Spring Framework is licensed under the Apache License, Version 2.0. This is a permissive free software license that allows users to freely use, modify, and distribute the software, even for commercial purposes, while requiring attribution and preservation of copyright notices, making it a popular choice for open-source projects.

  3. In Spring, what are the IoC containers?

    Answer: BeanFactory, ApplicationContext

    In Spring, the primary Inversion of Control (IoC) containers are the BeanFactory and the ApplicationContext. The BeanFactory provides the basic functionality for managing beans, while the ApplicationContext is an enhanced version that builds upon BeanFactory, offering additional enterprise-specific features like internationalization, event publishing, and declarative transaction management.

  4. Spring has been created by

    Answer: Pivotal Software

    The Spring Framework was initially created by Rod Johnson. Over time, its development and stewardship evolved, and it was primarily maintained and supported by Pivotal Software. Pivotal Software was later acquired by Broadcom's VMware Tanzu division, but Pivotal Software is recognized as the key entity responsible for its development and advancement among the given choices.

  5. What is the scope of a request?

    Answer: This scopes a bean definition to an HTTP request.

    In Spring, the 'request' scope dictates that a new instance of a bean is created for each incoming HTTP request. This specific bean instance is active and available only for the duration of that particular HTTP request. Once the request completes, the bean instance is destroyed, making it ideal for handling request-specific data.

  6. Dependent injection, often known as IOC, is a.. .

    Answer: Design Pattern

    Dependency Injection (DI), often referred to as a specific implementation of Inversion of Control (IoC), is a fundamental design pattern in software engineering. It promotes loose coupling by allowing an object's dependencies to be provided or 'injected' externally, rather than the object creating them itself, which enhances modularity, testability, and maintainability of code.

  7. Which of the following is a suitable replacement for Spring HibernateTemplate?

    Answer: Hibernate contextual sessions

    Spring's `HibernateTemplate` was deprecated because it tightly coupled Spring with Hibernate's API and often hid underlying `Session` management complexities. Modern Hibernate (3.0+) introduced "contextual sessions," which are managed by Hibernate itself, typically bound to the current transaction or thread. This approach aligns better with the standard Hibernate API and reduces the need for Spring-specific abstractions, making `SessionFactory.getCurrentSession()` the preferred way to obtain a session.

  8. What is autowiring Which of these isn't a Spring Module?

    Answer: Similar to byType, but type applies to constructor arguments. If there is not exactly one bean of the constructor argument type in the container, a fatal error is raised.

    Autowiring by constructor attempts to inject dependencies into a bean's constructor. Spring looks for a constructor whose arguments match the types of beans available in the container. If there isn't exactly one bean of a particular argument type, Spring cannot resolve the dependency unambiguously and will throw a fatal error, preventing the application from starting. This ensures strong type safety and explicit dependency resolution.

  9. Which of these isn't a Spring Module?

    Answer: HTML/JSP

    Spring Framework is modular, offering various components like Spring MVC for web applications, AOP for aspect-oriented programming, and O/R Integration for database interaction (e.g., with Hibernate or JPA). HTML/JSP are presentation technologies used *with* Spring MVC, but they are not modules *of* the Spring Framework itself. They are standard web technologies that Spring integrates with.

  10. After shutting the spring container, which of the following methods is used to gently end all bean processes?

    Answer: shutdownHook

    The `shutdownHook` method, typically registered via `AbstractApplicationContext.registerShutdownHook()`, allows the Spring container to gracefully shut down. When the JVM exits, this hook is invoked, ensuring that all singleton beans are properly destroyed by calling their configured `destroy` methods. This prevents resource leaks and ensures a clean application termination.

  11. What are the different types of advice?

    Answer: Before, after, after-returning, after-throwing, around

    In Spring AOP (Aspect-Oriented Programming), advice defines the action an aspect takes at a particular join point. The five main types of advice are: `Before` (executes before a method), `After` (executes after a method, regardless of outcome), `After-returning` (executes after a method completes successfully), `After-throwing` (executes if a method exits by throwing an exception), and `Around` (surrounds a method call, allowing custom behavior before and after).

  12. Which of the following statements is correct?

    Answer: ApplicationContext extends BeanFactory

    The `ApplicationContext` is Spring's advanced container, building upon the basic functionality of the `BeanFactory`. It provides more enterprise-specific features like AOP integration, message resource handling, event publication, and web application contexts. Therefore, `ApplicationContext` extends `BeanFactory`, inheriting its core bean management capabilities while adding significant enhancements.

  13. What is the scope of a bean in the context of a portlet?

    Answer: global-session

    In a portlet environment, the `global-session` scope is specific to Spring WebFlux or Spring MVC applications running in a portlet container. It defines a bean's lifecycle to be shared across all portlets that are part of the same global session. This means the bean is available for the duration of the portlet application's global session, which is distinct from a standard HTTP session.

  14. What is the definition of the Join Point?

    Answer: This represents a point in your application where you can plug-in AOP aspect.

    In Aspect-Oriented Programming (AOP), a join point is a specific point during the execution of a program, such as a method call, method execution, or field access. It is a candidate point where an aspect's advice can be applied. Spring AOP primarily supports method execution join points, allowing developers to "plug in" cross-cutting concerns at these well-defined points.

  15. By default, beans defined in the spring framework are..

    Answer: Singleton

    By default, Spring beans are singletons, meaning that the Spring container creates exactly one instance of the bean definition per container. All requests for that bean will return the same shared instance. This is a common and efficient default, as it reduces object creation overhead and promotes stateless services.

  16. Is it possible to integrate Struts and Spring?

    Answer: B) Yes

    Yes, it is entirely possible to integrate Struts and Spring. Spring provides integration modules and mechanisms, such as `ContextLoaderPlugIn` for Struts 1 or listeners for Struts 2, to allow Struts actions to be managed as Spring beans. This enables developers to leverage Spring's dependency injection and other features within a Struts application.

  17. Which version of the spring framework introduced the Expression Language/ SpEL?

    Answer: 3.0

    Spring Expression Language (SpEL) was introduced with Spring Framework 3.0. SpEL is a powerful expression language that supports querying and manipulating an object graph at runtime. It can be used in various Spring components, such as XML and annotation-based configurations, to provide dynamic values and logic.

  18. What are the various kinds of bean injections?

    Answer: constructor and setter

    Spring primarily supports two main types of dependency injection: constructor injection and setter injection. Constructor injection involves providing dependencies through a bean's constructor, ensuring that the bean is fully initialized upon creation. Setter injection involves providing dependencies through public setter methods, allowing for optional dependencies or later modification.

  19. What are the ways to use Spring to access Hibernate?

    Answer: A and B

    Spring provides multiple ways to integrate with Hibernate. One common approach is to extend `HibernateDAOSupport`, which provides convenient methods for interacting with Hibernate `SessionFactory`. Another powerful method involves using `HibernateTemplate` (though now deprecated in favor of contextual sessions) with a `Callback` interface, or more generally, using Inversion of Control (IoC) to manage Hibernate `SessionFactory` and `Session` objects, often combined with AOP for transaction management.

  20. What are the different types of autowire?

    Answer: byName , byType, constructor and autodetect

    Spring supports several autowiring modes to automatically resolve and inject dependencies. These include `byName` (matches bean properties by name), `byType` (matches bean properties by type), `constructor` (matches constructor arguments by type), and `autodetect` (Spring first tries `constructor` autowiring, then `byType`). These modes simplify configuration by reducing explicit dependency declarations.

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. Exam facts are checked against the official sources listed below. Not reviewed by a subject-matter expert. Editorial policy

Sources & references

Exam facts on this page (fees, format, dates, passing scores) are checked against these official sources; the date is our last check. Editorial policy

  1. docs.broadcom.com — Test delivery, retake policy, exam information · verified Oct 2026
  2. spring-academy.broadcom.com — Eligibility · verified Oct 2026
  3. broadcom.com — Fees, exam format, passing score, time limit · verified Oct 2026
Spring Framework Flashcards — Spring Framework Study Cards with Answers