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.
advertisement

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.

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.

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.
advertisement

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.

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.

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.
advertisement

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.

advertisement
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He is Linux Kernel Developer & SAN Architect and is passionate about competency developments in these areas. He lives in Bangalore and delivers focused training sessions to IT professionals in Linux Kernel, Linux Debugging, Linux Device Drivers, Linux Networking, Linux Storage, Advanced C Programming, SAN Storage Technologies, SCSI Internals & Storage Protocols such as iSCSI & Fiber Channel. Stay connected with him @ LinkedIn