Spring Questions and Answers – Refreshing and Defining Beans from Scripts

«
»

This set of Java Spring Multiple Choice Questions & Answers (MCQs) focuses on “Refreshing and Defining Beans from Scripts”.

1. Attribute used by Spring to refresh beans
a) refresh-check-interval
b) refresh-check-delay
c) refresh-delay
d) none of the mentioned
View Answer

Answer: b
Explanation: Spring is able to refresh a scripted bean definition from its source once you have specified the checking interval in the refresh-check-delay attribute.
advertisement

2. Spring IoC container refreshes the script periodically according to the interval period specified
a) True
b) False
View Answer

Answer: a
Explanation: When a method is called on that bean, Spring will check the script source if the specified checking interval has elapsed. The Spring will refresh the bean definition from the script source if it has been changed.

3. Default value of refresh-check-delay attribute
a) Zero
b) Negative
c) Positive
d) None of the mentioned above
View Answer

Answer: b
Explanation: By default, the refresh-check-delay attribute is negative, so the refresh checking feature is disabled. You can assign the milliseconds for refresh checking in this attribute to enable this feature.

4. XML Element to define an inline script
a) lang:inlinescript
b) lang:inline_script
c) lang:[email protected]
d) lang:inline-script
View Answer

Answer: d
Explanation: You can define an inline script source in the lang:inline-script element of a scripted bean to replace a reference to an external script source file by the script-source attribute.
advertisement

5. Refresh checking feature is not applicable for an inline script
a) True
b) False
View Answer

Answer: a
Explanation: Spring IoC container only loads the bean configuration once, at startup.

6. To prevent the characters in your script from conflicting with the reserved XML characters
a) Use ![CDATA[…]] tag
b) Use ![DATA[…]] tag
c) Use ![CDATA(…)] tag
d) None of the mentioned
View Answer

Answer: a
Explanation: You no longer have to specify the reference to the external script source file in the script-source attribute.

7. Dynamic-language-backed bean with some configurations
a) Refreshable bean
b) Beanshell
c) Scripting Beans
d) Inline Script
View Answer

Answer: a
Explanation: A refreshable bean is a dynamic-language-backed bean that with a small amount of configuration, a dynamic-language-backed bean can monitor changes in its underlying source file resource, and then reload itself when the dynamic language source file is changed.
advertisement

8. To quickly add a Spring Validator implementation to a Spring MVC Controller
a) Use inline-script
b) lang:inline-script
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: c
Explanation: If we put to one side the issues surrounding whether it is good practice to define dynamic language source inside a Spring configuration file, the lang:inline-script/ element can be useful in some scenarios.

9. Spring can detect and refresh changes from the script source files
a) True
b) False
View Answer

Answer: a
Exlanation: Using Refreshing Inline script.

10. Script’s location is specified by attribute
a) script-source
b) xml-source
c) script-annotation
d) none of the mentioned
View Answer

Answer: a
Explanation: Specifying the script’s location in the script-source attribute.
advertisement

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