Spring Questions and Answers – EJB 3.0 with Spring

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

Answer: a
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

Answer: c
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

Answer: a
Explanation: To do this, use Spring’s SpringBeanAutowiringInterceptor class to provide configuration for the EJB.
advertisement
advertisement

4. Annotation which decorates the PostageServiceBean:-
a) @Interceptors
b) @Autowire
c) @Wire
d) @Mention
View Answer

Answer: a
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

Answer: a
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.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. EJB interface is a simple Java interface whose methods don’t throw RemoteException.
a) True
b) False
View Answer

Answer: a
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

Answer: b
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.
advertisement

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

Answer: a
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

Answer: c
Explanation: You can configure the JNDI details for factory bean in the jndiEnvironment and jndiName properties.
advertisement

10. Lightweight remoting technologies developed by Caucho Technology.
a) Hessian
b) Burlap
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: c
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

Answer: a
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

Answer: c
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

Answer: a
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

Answer: a
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

Answer: b
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]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.