Spring Core

Spring Bean Scopes in IoC Container

<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div dir&equals;"ltr" style&equals;"text-align&colon; justify&semi;">&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">In this article we will discuss about Spring bean scopes&period; In Spring application&comma; we get the bean from the <b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">Spring container<&sol;a> <&sol;b>with some default configuration&period; <b>Default behavior is that every beans in the <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">Spring container<&sol;a> are initialized when <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;what-is-bean-factory-in-spring&sol;">bean configuration file<&sol;a> loaded to the <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;java-virtual-machine&sol;">JVM<&sol;a><&sol;b>&period;  Whenever <b>getBean <&sol;b>is called container recognized the <b>bean by given bean id and return that bean to the caller<&sol;b>&period; <b>One more default behavior is that every beans has only one instance in the <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">spring container<&sol;a>&period;<&sol;b><&sol;div>&NewLine;<h2>Spring Bean Scopes<&sol;h2>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">&NewLine;<p>Spring Bean Scopes means which is used to decide which type of bean instance should be return from <b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">Spring container<&sol;a> back to the caller&period;<&sol;b> Basic Spring Bean Scopes are only two types-<&sol;p>&NewLine;<h3><b>1&period; Singleton&colon;&lpar;Default&rpar;<&sol;b><&sol;h3>&NewLine;<p>Scopes a single bean definition to a single object instance per Spring IoC container&period;<&sol;p>&NewLine;<h3><b>2&period; Prototype<&sol;b>&colon;<&sol;h3>&NewLine;<p>Scopes a single bean definition to any number of object instances&period;<&sol;p>&NewLine;<p>But at web environment spring have three more scopes as following&colon;<&sol;p>&NewLine;<h3><b>Request Scope<&sol;b>&colon;<&sol;h3>&NewLine;<p>This scopes a bean definition to an HTTP request&period;<&sol;p>&NewLine;<h3><b>Session Scope<&sol;b>&colon;<&sol;h3>&NewLine;<p>This scopes a bean definition to an HTTP session&period;<&sol;p>&NewLine;<h3><b>Global Session<&sol;b>&colon;<&sol;h3>&NewLine;<p>Scopes a single bean definition to the lifecycle of a global HTTP Session&period;<&sol;p>&NewLine;<p><b> <&sol;b><&sol;p>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2012&sol;06&sol;Spring-Bean-Scopes&period;jpg" width&equals;"640" height&equals;"400" border&equals;"0" &sol;><&sol;div>&NewLine;<p><b> <&sol;b><&sol;p>&NewLine;<&sol;div>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">&NewLine;<p>We can control not only the various <b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;dependency-injection-in-spring&sol;">dependencies and configuration<&sol;a><&sol;b> values that are to be plugged into an object that is created from a particular bean definition&comma; but also the <i class&equals;"firstterm">scope<&sol;i> of the objects created from a particular bean definition&period; This approach is very powerful and gives you the flexibility to <i>choose<&sol;i> the scope of the objects you create through configuration&period;<&sol;p>&NewLine;<&sol;div>&NewLine;<div style&equals;"background-color&colon; &num;f2f9fc&semi; border&colon; 1px solid &num;c9e6f2&semi; border-radius&colon; 3px&semi; padding&colon; 16px&semi; line-height&colon; 1&period;45&semi;">&NewLine;<p><span style&equals;"color&colon; red&semi; font-size&colon; x-large&semi; text-align&colon; center&semi;"><b>Popular Tutorials<&sol;b><&sol;span><&sol;p>&NewLine;<ul style&equals;"text-align&colon; left&semi;">&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-tutorial&sol;"><em><strong>Spring Tutorial<&sol;strong> <&sol;em><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-web-mvc-framework-chapter-38&sol;"><strong><em>Spring MVC Web Tutorial <&sol;em><&sol;strong><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;introduction-to-spring-boot-a-spring-boot-complete-guide&sol;"><strong>Spring Boot Tutorial<&sol;strong> <&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-security-take-baby-step-to-secure&sol;"><em>Spring Security Tutorial<&sol;em><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-tutorial-with-example-aspect-advice-pointcut-joinpoint&sol;"><em>Spring AOP Tutorial<&sol;em><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;using-spring-jdbc-framework-chapter-32&sol;"><em>Spring JDBC Tutorial<&sol;em><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-hateoas-hypermedia-driven-restful-web-service&sol;"><em><strong>Spring HATEOAS <&sol;strong><&sol;em><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;microservices-with-spring-boot&sol;"><em><strong>Microservices with Spring Boot<&sol;strong><&sol;em><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;jax-rs-web-service-tutorial&sol;"><strong><em>REST Webservice<&sol;em> <&sol;strong><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;core-java-baby-step-to-be-best-java-ian&sol;"><em><strong>Core Java <&sol;strong><&sol;em><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;hibernate-3-on-baby-steps&sol;"><em><strong>Hibernate Tutorial<&sol;strong><&sol;em><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-batch-process-with-example&sol;"><strong><em>Spring Batch<&sol;em> <&sol;strong><&sol;a><&sol;b><&sol;li>&NewLine;<&sol;ul>&NewLine;<&sol;div>&NewLine;<div><&sol;div>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;"><b>Basic Spring Bean Scopes <&sol;b>are only two types are given below&period;<&sol;div>&NewLine;<ol style&equals;"text-align&colon; left&semi;">&NewLine;<li style&equals;"color&colon; &num;274e13&semi;"><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;singleton-bean-scope-in-spring&sol;">Singleton Bean Scope<&sol;a> &&num;8211&semi; <&sol;b>Return a single bean instance per <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">Spring IoC container<&sol;a><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;prototype-bean-scope-with-annotation&sol;">Prototype Bean Scope<&sol;a> &&num;8211&semi; <&sol;b>Return a new bean instance each time when requested<&sol;li>&NewLine;<&sol;ol>&NewLine;<&sol;div>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">&NewLine;<h2><b>1&period; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;singleton-bean-scope-in-spring&sol;">Singleton Bean Scope<&sol;a>&colon; <&sol;b><&sol;h2>&NewLine;<p>Scopes a single bean definition to a single object instance per <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">Spring IoC container<&sol;a>&period; This is the default behavior of the <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">spring container<&sol;a>&period;<&sol;p>&NewLine;<&sol;div>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">&NewLine;<p>When a bean is a <b>singleton<&sol;b>&comma; only one <i>shared<&sol;i> instance of the bean will be managed&comma; and all requests for beans with an<i><b> id or ids<&sol;b><&sol;i> matching that bean definition will result in that one specific bean instance being returned by the <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">Spring container<&sol;a>&period;<&sol;p>&NewLine;<&sol;div>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">&NewLine;<p>We can say another way&comma; <b>when you define a bean definition and it is scoped as a singleton&comma;<&sol;b> then the <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">Spring IoC container<&sol;a> will create <b><i>exactly one<&sol;i> <i>instance <&sol;i><&sol;b>of the object defined by that bean definition&period; This single instance will be stored in a cache of such singleton beans&comma; and <b><i>all subsequent requests and references<&sol;i> <&sol;b>for that named bean will result in the <b>cached object being returned<&sol;b>&period;<&sol;p>&NewLine;<p>To define a singleton scope&comma; you can set the <b>scope<&sol;b> property to <b>singleton<&sol;b> in the bean configuration file&comma; as shown below&colon;<&sol;p>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;<pre class&equals;"highlight">&lt&semi;bean class&equals;"com&period;dineshonjava&period;sdnext&period;beanscope&period;Point" id&equals;"zeroPoint" scope&equals;"singleton"&gt&semi; &NewLine; &lt&semi;property name&equals;"x" value&equals;"0"&gt&semi;&lt&semi;&sol;property&gt&semi; &NewLine; &lt&semi;property name&equals;"y" value&equals;"0"&gt&semi;&lt&semi;&sol;property&gt&semi; &NewLine;&lt&semi;&sol;bean&gt&semi; &NewLine;<&sol;pre>&NewLine;<p><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;singleton-bean-scope-in-spring&sol;">See the singleton scope of bean with full example&period;<&sol;a><&sol;b><&sol;p>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;"><b>Using Annotation for Bean Scope&colon;<&sol;b><&sol;div>&NewLine;<pre class&equals;"highlight">&commat;Service &NewLine;&commat;Scope&lpar;"singleton"&rpar; &NewLine;public class Point &NewLine;&lbrace; &NewLine; private int x&semi; &NewLine; private int y&semi; &NewLine; &NewLine; public void setX&lpar;int x&rpar;&lbrace; &NewLine; this&period;x &equals; x&semi; &NewLine; &rcub; &NewLine; &NewLine; public void setY&lpar;int y&rpar;&lbrace; &NewLine; this&period;y &equals; y&semi; &NewLine; &rcub; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<p><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;singleton-bean-scope-in-spring&sol;">See the singleton scope of bean with full example&period;<&sol;a><&sol;b><br &sol;>&NewLine;<b style&equals;"color&colon; blue&semi;">NOTE<&sol;b> &colon; This singleton is differ from the singleton pattern in Java Class&period; <b>Single pattern in java mean you can create the only one instance of a that class in <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;java-virtual-machine&sol;">JVM<&sol;a><&sol;b>&period; <b>But In spring singleton bean scope means every container can create only single bean in the <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">Spring IoC Container<&sol;a> but a <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;java-virtual-machine&sol;">JVM <&sol;a>can have multiple <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">Spring IoC Container<&sol;a> so <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;java-virtual-machine&sol;">JVM <&sol;a>can multiple beans rather than bean singleton bean scope&period;<&sol;b><&sol;p>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2012&sol;06&sol;singleton&period;jpg" width&equals;"640" height&equals;"324" border&equals;"0" &sol;><&sol;div>&NewLine;<h2><b>2&period; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;prototype-bean-scope-with-annotation">Prototype Bean Scope<&sol;a>&colon; <&sol;b><&sol;h2>&NewLine;<p>If scope is set to prototype&comma; the <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">Spring IoC container<&sol;a> creates new bean instance of the object every time a request for that specific bean is made&period; <b>As a rule&comma; use the prototype scope for all state-full beans and the singleton scope for stateless beans&period;<&sol;b><br &sol;>&NewLine;<b><br &sol;>&NewLine;<&sol;b> To define a prototype scope&comma; you can set the <b>scope<&sol;b> property to <b>prototype<&sol;b> in the bean configuration file&comma; as shown below&colon;<&sol;p>&NewLine;<pre class&equals;"highlight">&lt&semi;bean class&equals;"com&period;dineshonjava&period;sdnext&period;beanscope&period;Point" id&equals;"zeroPoint" scope&equals;"prototype"&gt&semi;&lt&semi;property name&equals;"x" value&equals;"0"&gt&semi;&lt&semi;&sol;property&gt&semi; &NewLine; &lt&semi;property name&equals;"y" value&equals;"0"&gt&semi;&lt&semi;&sol;property&gt&semi; &NewLine;&lt&semi;&sol;bean&gt&semi; &NewLine;<&sol;pre>&NewLine;<p><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;prototype-bean-scope-with-annotation&sol;">See the full example of prototype bean scope with using the Annotation&period;<&sol;a><&sol;b><&sol;p>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;"><b>Using Annotation for Bean Scope&colon;<&sol;b><&sol;div>&NewLine;<pre class&equals;"highlight">&commat;Service &NewLine;&commat;Scope&lpar;"prototype"&rpar; &NewLine;public class Point &NewLine;&lbrace; &NewLine; private int x&semi; &NewLine; private int y&semi; &NewLine; &NewLine; public void setX&lpar;int x&rpar;&lbrace; &NewLine; this&period;x &equals; x&semi; &NewLine; &rcub; &NewLine; &NewLine; public void setY&lpar;int y&rpar;&lbrace; &NewLine; this&period;y &equals; y&semi; &NewLine; &rcub; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<p><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;prototype-bean-scope-with-annotation&sol;">See the full example of prototype bean scope with using the Annotation&period;<&sol;a><&sol;b><&sol;p>&NewLine;<&sol;div>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2012&sol;06&sol;prototype&period;jpg" width&equals;"640" height&equals;"323" border&equals;"0" &sol;><&sol;div>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<&sol;div>&NewLine;<div style&equals;"color&colon; blue&semi;"><b>There are three wen application aware bean scope are given below&period;<&sol;b><&sol;div>&NewLine;<h2 style&equals;"color&colon; &num;274e13&semi;"><b>1&period; Request Scope&colon;<&sol;b><&sol;h2>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">This scopes a bean definition to an HTTP request&period; Only valid in the context of a web-aware Spring ApplicationContext&period;<&sol;div>&NewLine;<pre class&equals;"highlight" style&equals;"color&colon; &num;274e13&semi;">&lt&semi;bean class&equals;"com&period;dineshonjava&period;Point" id&equals;"point" scope&equals;"request"&gt&semi;&lt&semi;&sol;bean&gt&semi; &NewLine;<&sol;pre>&NewLine;<h2 style&equals;"color&colon; &num;274e13&semi;"><b>2&period; Session Scope&colon;<&sol;b><&sol;h2>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">This scopes a bean definition to an HTTP session&period; Only valid in the context of a web-aware Spring ApplicationContext&period;<&sol;div>&NewLine;<pre class&equals;"highlight" style&equals;"color&colon; &num;274e13&semi;">&lt&semi;bean class&equals;"com&period;dineshonjava&period;Point" id&equals;"point" scope&equals;"session"&gt&semi;&lt&semi;&sol;bean&gt&semi; &NewLine;<&sol;pre>&NewLine;<h2 style&equals;"color&colon; &num;274e13&semi;"><b>3&period; global-session&colon;<&sol;b><&sol;h2>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">This scopes a bean definition to a global HTTP session&period; Only valid in the context of a web-aware Spring ApplicationContext&period;<&sol;div>&NewLine;<pre class&equals;"highlight" style&equals;"color&colon; &num;274e13&semi;">&lt&semi;bean class&equals;"com&period;dineshonjava&period;Point" id&equals;"point" scope&equals;"globalSession"&gt&semi;&lt&semi;&sol;bean&gt&semi; &NewLine;<&sol;pre>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">The global session scope is similar to the standard HTTP Session scope &lpar;described immediately above&rpar;&comma; and really only makes sense in the context of portlet-based web applications&period; The portlet specification defines the notion of a global Session that is shared amongst all of the various portlets that make up a single portlet web application&period; Beans defined at the global session scope are scoped &lpar;or bound&rpar; to the lifetime of the global portlet Session&period;<&sol;div>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">&NewLine;<p>Please note that if you are writing a standard Servlet-based web application and you define one or more beans as having global session scope&comma; the standard HTTP Session scope will be used&comma; and no error will be raised&period;<&sol;p>&NewLine;<div style&equals;"background-color&colon; &num;f2f9fc&semi; border-radius&colon; 3px&semi; border&colon; 1px solid &num;c9e6f2&semi; line-height&colon; 1&period;45&semi; padding&colon; 16px&semi;">&NewLine;<p><span style&equals;"color&colon; red&semi; font-size&colon; x-large&semi; text-align&colon; center&semi;"><b>Spring Related Topics you may like<&sol;b><&sol;span><&sol;p>&NewLine;<ul>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;interview-questions-on-spring&sol;"><span style&equals;"color&colon; red&semi;">Spring Interview Questions and Answers<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-interview-questions-and-answers&sol;"><span style&equals;"color&colon; red&semi;">Spring AOP Interview Questions and Answers<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-mvc-interview-questions-and-answers&sol;"><span style&equals;"color&colon; red&semi;">Spring MVC Interview Questions<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-security-interview-questions-and-answers&sol;"><span style&equals;"color&colon; red&semi;">Spring Security Interview Questions and Answers<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-rest-web-services-interview-questions-and-answers&sol;"><span style&equals;"color&colon; red&semi;">Spring REST Interview Questions and Answers<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-boot-interview-questions-and-answers&sol;"><span style&equals;"color&colon; red&semi;">Spring Boot Interview Questions and Answers<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-boot-microservices-interview-questions-answers&sol;"><span style&equals;"color&colon; red&semi;">Spring Boot Microservices Interview Questions and Answers<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;dependency-injection-in-spring&sol;"><span style&equals;"color&colon; red&semi;">Dependency Injection &lpar;DI&rpar; in Spring <&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;"><span style&equals;"color&colon; red&semi;">Spring IoC Container<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;what-is-bean-factory-in-spring&sol;"><span style&equals;"color&colon; red&semi;">What is Bean Factory in Spring<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;application-context-in-spring&sol;"><span style&equals;"color&colon; red&semi;">ApplicationContext in Spring<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;bean-autowiring-in-spring&sol;"><span style&equals;"color&colon; red&semi;">Bean Autowiring in Spring<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;understanding-bean-scopes&sol;"><span style&equals;"color&colon; red&semi;">Spring Bean Scopes<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;create-custom-bean-scope-in-spring-example&sol;"><span style&equals;"color&colon; red&semi;">Create Custom Bean Scope in Spring Example<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;using-applicationcontextaware-in-spring&sol;"><span style&equals;"color&colon; red&semi;">Using ApplicationContextAware in Spring<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;bean-lifecycle-and-callbacks&sol;"><span style&equals;"color&colon; red&semi;">Spring Bean Life Cycle and Callbacks<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;writing-beanpostprocessor-in-spring&sol;"><span style&equals;"color&colon; red&semi;">BeanPostProcessor in Spring<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;writing-beanfactorypostprocessor-in&sol;"><span style&equals;"color&colon; red&semi;">BeanFactoryPostProcessor in Spring<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;annotations-in-spring-and-based&sol;"><span style&equals;"color&colon; red&semi;"> Annotations in Spring and Based Configuration<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-jsr-250-annotations&sol;"><span style&equals;"color&colon; red&semi;">Spring JSR-250 Annotations<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;jsr-330-annotations-in-spring&sol;"><span style&equals;"color&colon; red&semi;">JSR 330 Annotations in Spring<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;stereotype-annotations-in-spring&sol;"><span style&equals;"color&colon; red&semi;">Spring &commat;Component&comma; &commat;Repository&comma; &commat;Service and &commat;Controller Stereotype Annotations<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;method-injection-with-spring-using-lookup-method-property&sol;"><span style&equals;"color&colon; red&semi;">Method injection with Spring using Lookup method property<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;introduction-to-aop-in-spring&sol;"><span style&equals;"color&colon; red&semi;">Spring AOP-Introduction to Aspect Oriented Programming<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aspect-annotation&sol;"><span style&equals;"color&colon; red&semi;">&commat;Aspect Annotation in Spring<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-aspectj-before-annotation-advice-example&sol;"><span style&equals;"color&colon; red&semi;"> Spring AOP AspectJ &commat;Before Annotation Advice Example<br &sol;>&NewLine;<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-before-advice-example-using-xml-config&sol;"><span style&equals;"color&colon; red&semi;"> Spring AOP Before Advice Example using XML Config<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-aspectj-after-annotation-advice-example&sol;"><span style&equals;"color&colon; red&semi;"> Spring AOP AspectJ &commat;After Annotation Advice Example<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-after-advice-example-using-xml-config&sol;"><span style&equals;"color&colon; red&semi;"> Spring AOP After Advice Example using XML Config<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-aspectj-after-returning-annotation-advice-example&sol;"><span style&equals;"color&colon; red&semi;"> Spring AOP AspectJ &commat;AfterReturning Annotation Advice Example<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-after-returning-advice-example-using-xml-config&sol;"><span style&equals;"color&colon; red&semi;"> Spring AOP After-Returning Advice Example using XML Config<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-aspectj-after-throwing-annotation-advice-example&sol;"><span style&equals;"color&colon; red&semi;"> Spring AOP AspectJ &commat;AfterThrowing Annotation Advice Example<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-after-throwing-advice-example-using-xml-config&sol;"><span style&equals;"color&colon; red&semi;"> Spring AOP After Throwing Advice Example using XML Config<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-aspectj-around-annotation-advice-example&sol;"><span style&equals;"color&colon; red&semi;"> Spring AOP AspectJ &commat;Around Annotation Advice Example<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-around-advice-example-using-xml-config&sol;"><span style&equals;"color&colon; red&semi;"> Spring AOP Around Advice Example using XML Config<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;understanding-aop-proxies-chapter-31&sol;"><span style&equals;"color&colon; red&semi;">Spring AOP Proxies in Spring<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-transaction-management-in&sol;"><span style&equals;"color&colon; red&semi;"> Spring AOP Transaction Management in Hibernate<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;transaction-management-in-spring&sol;"><span style&equals;"color&colon; red&semi;">Spring Transaction Management<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;declarative-transaction-management&sol;"><span style&equals;"color&colon; red&semi;">Spring Declarative Transaction Management Example<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-aop-ordering-of-aspects-with-example&sol;"><span style&equals;"color&colon; red&semi;">Spring AOP-Ordering of Aspects with Example<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-security-java-based-configuration-with-example&sol;"><span style&equals;"color&colon; red&semi;">Spring Security Java Based Configuration with Example<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<li><b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-security-xml-namespace-configuration-example&sol;"><span style&equals;"color&colon; red&semi;">Spring Security XML Namespace Configuration Example<&sol;span><&sol;a><&sol;b><&sol;li>&NewLine;<&sol;ul>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;<&sol;div>&NewLine;<div class&equals;"wp-post-navigation"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-pre"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-autowiring-by-type&sol;">Previous<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <div class&equals;"wp-post-navigation-next"> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-autowiring-by-constructor&sol;">Next<&sol;a> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab; <&sol;div> &NewLine;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;&Tab;<&sol;div>&NewLine;<script type&equals;"text&sol;javascript">&NewLine;jQuery&lpar;document&rpar;&period;ready&lpar;function&lpar;&dollar;&rpar; &lbrace;&NewLine; &dollar;&period;post&lpar;'https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-admin&sol;admin-ajax&period;php'&comma; &lbrace;action&colon; 'mts&lowbar;view&lowbar;count'&comma; id&colon; '670'&rcub;&rpar;&semi;&NewLine;&rcub;&rpar;&semi;&NewLine;<&sol;script>

Dinesh Rajput

Dinesh Rajput is the chief editor of a website Dineshonjava, a technical blog dedicated to the Spring and Java technologies. It has a series of articles related to Java technologies. Dinesh has been a Spring enthusiast since 2008 and is a Pivotal Certified Spring Professional, an author of a book Spring 5 Design Pattern, and a blogger. He has more than 10 years of experience with different aspects of Spring and Java design and development. His core expertise lies in the latest version of Spring Framework, Spring Boot, Spring Security, creating REST APIs, Microservice Architecture, Reactive Pattern, Spring AOP, Design Patterns, Struts, Hibernate, Web Services, Spring Batch, Cassandra, MongoDB, and Web Application Design and Architecture. He is currently working as a technology manager at a leading product and web development company. He worked as a developer and tech lead at the Bennett, Coleman & Co. Ltd and was the first developer in his previous company, Paytm. Dinesh is passionate about the latest Java technologies and loves to write technical blogs related to it. He is a very active member of the Java and Spring community on different forums. When it comes to the Spring Framework and Java, Dinesh tops the list!

Share
Published by
Dinesh Rajput

Recent Posts

Strategy Design Patterns using Lambda

Strategy Design Patterns We can easily create a strategy design pattern using lambda. To implement…

4 years ago

Decorator Pattern using Lambda

Decorator Pattern A decorator pattern allows a user to add new functionality to an existing…

4 years ago

Delegating pattern using lambda

Delegating pattern In software engineering, the delegation pattern is an object-oriented design pattern that allows…

4 years ago

Spring Vs Django- Know The Difference Between The Two

Technology has emerged a lot in the last decade, and now we have artificial intelligence;…

4 years ago

TOP 20 MongoDB INTERVIEW QUESTIONS 2022

Managing a database is becoming increasingly complex now due to the vast amount of data…

4 years ago

Scheduler @Scheduled Annotation Spring Boot

Overview In this article, we will explore Spring Scheduler how we could use it by…

4 years ago