Junior — Senior
Spring context initialization and BeanA bean retrieval
livecode
Task condition
Create a Spring context and obtain the BeanA bean using the getBean method. Requirements:
- Launch the Spring context.
- Define BeanA and its dependencies as Spring beans.
- Call
getBean(BeanA.class)to get an instance.
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
public class JetbulbInterview {
public static void main(String[] args) {
// Launch Spring application
// getBean(BeanA.class);
}
}
class BeanA {}
class BeanB {}
class BeanDependencyA {}
class BeanDependencyB {}