This set of Java Spring Multiple Choice Questions & Answers (MCQs) focuses on “EJB 3.0 with Spring”.
1. Interceptor to let Spring configure @Autowired elements on your EJB.
a) org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor
b) org.springframework.ejb.interceptor.SpringBeanAutowiring
c) org.springframework.ejb.interceptor.SpringBean
d) none of the mentioned
View Answer
Explanation: Use the org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor interceptor to let Spring configure @Autowired elements on your EJB.
2. A remote stateless session bean requires annotations:-
a) @Remote
b) @Stateless
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: A remote stateless session bean requires the @Stateless and @Remote annotations. In the @Remote annotation, you have to specify the remote interface for this EJB component.
3. Proxying Spring services with EJB3s, injecting custom resources configured in Spring, or even using Spring to isolate your EJBs from acquiring references to other distributed resources such as a REST endpoint or an RMI endpoint.
a) SpringBeanAutowiringInterceptor
b) SpringBeanAutowiring
c) SpringBean
d) SpringBeanInterceptor
View Answer
Explanation: To do this, use Spring’s SpringBeanAutowiringInterceptor class to provide configuration for the EJB.
4. Annotation which decorates the PostageServiceBean:-
a) @Interceptors
b) @Autowire
c) @Wire
d) @Mention
View Answer
Explanation: This tells Spring to handle @Autowired injection points in the class.
5. The interceptor obtains beans, by default, from a ContextSingletonBeanFactoryLocation.
a) True
b) False
View Answer
Explanation: The interceptor obtains beans, by default, from a ContextSingletonBeanFactoryLocation, which in turn looks for an XML application context named beanRefContext.xml, which is presumed to be on the classpath.
6. EJB interface is a simple Java interface whose methods don’t throw RemoteException.
a) True
b) False
View Answer
Explanation: EJB interface is a simple Java interface whose methods don’t throw RemoteException, while the implementation class is a simple Java class annotated with EJB annotations.
7. To declare a JNDI object reference in the Spring IoC container.
a) JndiObjectFactory
b) JndiObjectFactoryBean
c) JndiObject
d) JndiFactoryBean
View Answer
Explanation: By using Spring’s JndiObjectFactoryBean, you can easily declare a JNDI object reference in the Spring IoC container. You can use this factory bean to declare a reference to an EJB 3.0 component.
8. The default JNDI name for a remote EJB 3.0 component is the EJB class name with Remote as its suffix .
a) True
b) False
View Answer
Explanation: If you have chosen OpenEJB as your EJB container, the default JNDI name for a remote EJB 3.0 component is the EJB class name with Remote as its suffix (PostageServiceBeanRemote, in this case).
9. You can configure the JNDI details for factory bean in:-
a) jndiEnvironment
b) jndiName
c) all of the mentioned
d) none of the mentioned
View Answer
Explanation: You can configure the JNDI details for factory bean in the jndiEnvironment and jndiName properties.
10. Lightweight remoting technologies developed by Caucho Technology.
a) Hessian
b) Burlap
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: Hessian and Burlap are two simple lightweight remoting technologies developed by Caucho Technology (http://www.caucho.com/).
11. Spring framework itself also offers a remoting technology called HTTP Invoker.
a) True
b) False
View Answer
Explanation: It also communicates over HTTP, but uses Java’s object serialization mechanism to serialize objects.
12. To expose a Hessian or Burlap service, you have to add the:-
a) Hessian library
b) Burlap library
c) All of the mentioned
d) None of the mentioned
View Answer
Explanation: To expose a Hessian or Burlap service, you have to add the Hessian library to your classpath.
13. For a HessianServiceExporter instance, you have to configure a service object to export and its service interface.
a) True
b) False
View Answer
Explanation: You can export any bean configured in the IoC container as a Hessian service, and HessianServiceExporter will create a proxy to wrap this bean.
14. By default, BeanNameUrlHandlerMapping is preconfigured for a Spring MVC application.
a) True
b) False
View Answer
Explanation: It maps requests to handlers according to the URL patterns specified as bean names.
15. Invoking a Burlap service:-
a) HessianProxyFactoryBean
b) BurlapProxyFactoryBean
c) BurlapProxyFactory
d) BurlapProxy
View Answer
Explanation: Invoking a Burlap service is very similar to Hessian. The only difference is that you should use BurlapProxyFactoryBean.
Sanfoundry Global Education & Learning Series – Java Spring.
To practice all areas of Java Spring, here is complete set of 1000+ Multiple Choice Questions and Answers.
If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]
- Practice Programming MCQs
- Check Spring Books
- Apply for Programming Internship
- Check Information Technology Books