Spring Core

@Autowired Annotation in Spring Example

<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 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 last <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;bean-autowiring-in-spring">Spring Bean Autowiring in Spring in XML<&sol;a> example&comma; it will autowired the matched property of any bean in current <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">Spring container<&sol;a>&period; In most cases&comma; you may need autowired property in a particular bean only&period;<&sol;div>&NewLine;<div id&equals;"ads-id" align&equals;"center"><&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;"><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 style&equals;"color&colon; &num;274e13&semi;">&NewLine;<h2><b>&commat;Autowired<&sol;b> annotation<&sol;h2>&NewLine;<p>In Spring&comma; you can use <b>&commat;Autowired<&sol;b> annotation to auto wire bean on the <b>setter method&comma; constructor or a field<&sol;b>&period; Moreover&comma; it can autowired property in a particular bean&period;<&sol;p>&NewLine;<div class&equals;"separator" style&equals;"clear&colon; both&semi; text-align&colon; center&semi;"><img class&equals;"alignnone" src&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;wp-content&sol;uploads&sol;2012&sol;07&sol;Autowired-Annotation-in-Spring&period;jpg" width&equals;"558" height&equals;"308" border&equals;"0" &sol;><&sol;div>&NewLine;<p><i>&commat;ImageSource-Slideshare&period;net<&sol;i><br &sol;>&NewLine;<b>Note<&sol;b>&colon;<br &sol;>&NewLine;The <b style&equals;"color&colon; blue&semi;">&commat;Autowired<&sol;b> annotation is auto wire the bean by matching <b style&equals;"color&colon; blue&semi;"><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-autowiring-by-type&sol;">data type<&sol;a> <&sol;b>if <b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-ioc-container&sol;">spring container<&sol;a><&sol;b> find more than one beans same <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-autowiring-by-type&sol;"><b>data type<&sol;b><&sol;a> then it find <a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-autowiring-by-name&sol;"><b>by name<&sol;b><&sol;a>&period;<&sol;p>&NewLine;<&sol;div>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">&NewLine;<h3><b>&commat;Autowired Annotation on Setter Method&colon;<&sol;b><&sol;h3>&NewLine;<p>You can use <b>&commat;Autowired<&sol;b> annotation on setter methods to get <i><b>ref id<&sol;b> <&sol;i>of the <b>&lt&semi;property&gt&semi;<&sol;b> element in XML configuration file<b>&lpar;spring&period;xml&rpar;<&sol;b>&period; When Spring finds an<b> &commat;Autowired <&sol;b>annotation used with setter methods&comma; it tries to perform <b><a href&equals;"https&colon;&sol;&sol;dineshonjava&period;com&sol;spring-autowiring-by-type&sol;">byType autowiring<&sol;a><&sol;b> on the method&period;<&sol;p>&NewLine;<p>See following full example to demonstrate the use of <b>&commat;Autowired<&sol;b>&period;<&sol;p>&NewLine;<&sol;div>&NewLine;<p><b>Circle&period;java<&sol;b><&sol;p>&NewLine;<pre class&equals;"highlight">package com&period;dineshonjava&period;sdnext&period;autowiredannotation&period;tutorial&semi; &NewLine; &NewLine;import org&period;springframework&period;beans&period;factory&period;annotation&period;Autowired&semi; &NewLine; &NewLine;public class Circle &NewLine;&lbrace; &NewLine; private Point center&semi; &NewLine; &sol;&sol;using autowired annotation with setter method &NewLine; &commat;Autowired &NewLine; public void setCenter&lpar;Point center&rpar; &NewLine; &lbrace; &NewLine; this&period;center &equals; center&semi; &NewLine; &rcub; &NewLine; &NewLine; public void draw&lpar;&rpar; &NewLine; &lbrace; &NewLine;System&period;out&period;println&lpar;"Circle is drawn of center &lpar;"&plus;center&period;getX&lpar;&rpar;&plus;"&comma; "&plus;center&period;getY&lpar;&rpar;&plus;"&rpar;"&rpar;&semi; &NewLine; &rcub; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<p><b>Point&period;java<&sol;b><&sol;p>&NewLine;<pre class&equals;"highlight">package com&period;dineshonjava&period;sdnext&period;autowiredannotation&period;tutorial&semi; &NewLine; &NewLine;public class Point &NewLine;&lbrace; &NewLine; private int x&semi; &NewLine; private int y&semi; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;return the x &NewLine; &ast;&sol; &NewLine; public int getX&lpar;&rpar; &lbrace; &NewLine; return x&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;param x the x to set &NewLine; &ast;&sol; &NewLine; public void setX&lpar;int x&rpar; &lbrace; &NewLine; this&period;x &equals; x&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;return the y &NewLine; &ast;&sol; &NewLine; public int getY&lpar;&rpar; &lbrace; &NewLine; return y&semi; &NewLine; &rcub; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;param y the y to set &NewLine; &ast;&sol; &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>DrawingApp&period;java<&sol;b><&sol;p>&NewLine;<pre class&equals;"highlight">package com&period;dineshonjava&period;sdnext&period;autowiredannotation&period;tutorial&semi; &NewLine; &NewLine;import org&period;springframework&period;context&period;ApplicationContext&semi; &NewLine;import org&period;springframework&period;context&period;support&period;ClassPathXmlApplicationContext&semi; &NewLine; &NewLine;&sol;&ast;&ast; &NewLine; &ast; &commat;author Dinesh Rajput &NewLine; &ast; &NewLine; &ast;&sol; &NewLine;public class DrawingApp &NewLine;&lbrace; &NewLine; &sol;&ast;&ast; &NewLine; &ast; &commat;param args &NewLine; &ast;&sol; &NewLine; public static void main&lpar;String&lbrack;&rsqb; args&rpar; &NewLine; &lbrace; &NewLine;ApplicationContext context &equals; new ClassPathXmlApplicationContext&lpar;"spring&period;xml"&rpar;&semi; &NewLine;Circle circle &equals; &lpar;Circle&rpar; context&period;getBean&lpar;"circle"&rpar;&semi; &NewLine;circle&period;draw&lpar;&rpar;&semi; &NewLine; &rcub; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<p><b>spring&period;xml<&sol;b><&sol;p>&NewLine;<pre class&equals;"highlight">&lt&semi;beans xmlns&colon;aop&equals;"http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;aop" xmlns&colon;context&equals;"http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;context" xmlns&colon;p&equals;"http&colon;&sol;&sol;www&period;springframework&period;org&sol;schema&sol;p" xmlns&colon;> &NewLine;Once you are done with creating source and bean configuration files&comma; let us run the application&period; If everything is fine with your application&comma; this will print the following message&colon; &NewLine;<div style&equals;"background-color&colon; &num;ff99cc&semi; border-width&colon; thin&semi; border&colon; solid&semi;"> &NewLine;<div style&equals;"color&colon; blue&semi;"><b>Output&colon;<&sol;b><&sol;div> &NewLine;<div style&equals;"color&colon; red&semi;">Jul 10&comma; 2012 7&colon;41&colon;44 PM org&period;springframework&period;context&period;support&period;AbstractApplicationContext prepareRefresh<&sol;div> &NewLine;<div style&equals;"color&colon; red&semi;">INFO&colon; Refreshing org&period;springframework&period;context&period;support&period;ClassPathXmlApplicationContext&commat;ab50cd&colon; startup date &lbrack;Tue Jul 10 19&colon;41&colon;44 IST 2012&rsqb;&semi; root of context hierarchy<&sol;div> &NewLine;<div style&equals;"color&colon; red&semi;">Jul 10&comma; 2012 7&colon;41&colon;44 PM org&period;springframework&period;beans&period;factory&period;xml&period;XmlBeanDefinitionReader loadBeanDefinitions<&sol;div> &NewLine;<div style&equals;"color&colon; red&semi;">INFO&colon; Loading XML bean definitions from class path resource &lbrack;spring&period;xml&rsqb;<&sol;div> &NewLine;<div style&equals;"color&colon; red&semi;">Jul 10&comma; 2012 7&colon;41&colon;44 PM org&period;springframework&period;beans&period;factory&period;support&period;DefaultListableBeanFactory preInstantiateSingletons<&sol;div> &NewLine;<div style&equals;"color&colon; red&semi;">INFO&colon; Pre-instantiating singletons in org&period;springframework&period;beans&period;factory&period;support&period;DefaultListableBeanFactory&commat;1d80e6d&colon; defining beans &lbrack;circle&comma;pointA&comma;pointB&comma;pointC&comma;center&comma;org&period;springframework&period;context&period;annotation&period;internalConfigurationAnnotationProcessor&comma;org&period;springframework&period;context&period;annotation&period;internalAutowiredAnnotationProcessor&comma;org&period;springframework&period;context&period;annotation&period;internalRequiredAnnotationProcessor&comma;org&period;springframework&period;context&period;annotation&period;internalCommonAnnotationProcessor&comma;org&period;springframework&period;context&period;annotation&period;ConfigurationClassPostProcessor&dollar;ImportAwareBeanPostProcessor&num;0&rsqb;&semi; root of factory hierarchy<&sol;div> &NewLine;<b>Circle is drawn of center &lpar;10&comma; 10&rpar;<&sol;b> &NewLine; &NewLine;<&sol;div> &NewLine;<&sol;div> &NewLine;&nbsp&semi; &NewLine;<h3 style&equals;"color&colon; &num;274e13&semi;"><b>&commat;Autowired Annotation on Properties&colon;<&sol;b><&sol;h3> &NewLine;<div style&equals;"color&colon; &num;274e13&semi;">You can use <b>&commat;Autowired<&sol;b> annotation on <b>properties <&sol;b>to get <i><b>ref id <&sol;b><&sol;i>of the setter methods&period; When you will pass values of autowired properties using Spring will automatically assign those properties with the passed values or references&period;<&sol;div> &NewLine;<&sol;div> &NewLine;<b>Circle&period;java<&sol;b> &NewLine;<pre class&equals;"highlight">package com&period;dineshonjava&period;sdnext&period;autowiredannotation&period;tutorial&semi; &NewLine; &NewLine;import org&period;springframework&period;beans&period;factory&period;annotation&period;Autowired&semi; &NewLine; &NewLine;public class Circle &NewLine;&lbrace; &NewLine; &sol;&sol;using autowired annotation with property &NewLine; &commat;Autowired &NewLine; private Point center&semi; &NewLine; &NewLine; public void setCenter&lpar;Point center&rpar; &NewLine; &lbrace; &NewLine; this&period;center &equals; center&semi; &NewLine; &rcub; &NewLine; &NewLine; public void draw&lpar;&rpar; &NewLine; &lbrace; &NewLine;System&period;out&period;println&lpar;"Circle is drawn of center &lpar;"&plus;center&period;getX&lpar;&rpar;&plus;"&comma; "&plus;center&period;getY&lpar;&rpar;&plus;"&rpar;"&rpar;&semi; &NewLine; &rcub; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;"><&sol;div>&NewLine;<h3 style&equals;"color&colon; &num;274e13&semi;"><b>&commat;Autowired Annotation on Constructors&colon;<&sol;b><&sol;h3>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">You can apply <b>&commat;Autowired<&sol;b> to constructors as well&period; A constructor <b>&commat;Autowired<&sol;b> annotation indicates that the <b>constructor <&sol;b>should be autowired when creating the bean&comma; even if no <b>&lt&semi;constructor-arg&sol;&gt&semi;<&sol;b> elements are used while configuring the bean in XML file&period;<&sol;div>&NewLine;<&sol;div>&NewLine;<p><b>Circle&period;java<&sol;b><&sol;p>&NewLine;<pre class&equals;"highlight">package com&period;dineshonjava&period;sdnext&period;autowiredannotation&period;tutorial&semi; &NewLine; &NewLine;import org&period;springframework&period;beans&period;factory&period;annotation&period;Autowired&semi; &NewLine; &NewLine;public class Circle &NewLine;&lbrace; &NewLine; private Point center&semi; &NewLine; &NewLine; &sol;&sol;using autowired annotation with constructor &NewLine; &commat;Autowired &NewLine; public Center&lpar;Point center&rpar; &NewLine; &lbrace; &NewLine; this&period;center &equals; center&semi; &NewLine; &rcub; &NewLine; &NewLine; public void draw&lpar;&rpar; &NewLine; &lbrace; &NewLine;System&period;out&period;println&lpar;"Circle is drawn of center &lpar;"&plus;center&period;getX&lpar;&rpar;&plus;"&comma; "&plus;center&period;getY&lpar;&rpar;&plus;"&rpar;"&rpar;&semi; &NewLine; &rcub; &NewLine;&rcub; &NewLine;<&sol;pre>&NewLine;<&sol;div>&NewLine;<h3><b>&commat;Autowired Annotation with &lpar;required&equals;false&rpar; option&colon; <&sol;b><&sol;h3>&NewLine;<div style&equals;"color&colon; &num;274e13&semi;">By default&comma; the &commat;Autowired annotation has the required dependency but we can set the required dependency to false as below&colon;<&sol;div>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;<&sol;div>&NewLine;<p><b>Circle&period;java<&sol;b><&sol;p>&NewLine;<pre class&equals;"highlight">package com&period;dineshonjava&period;sdnext&period;autowiredannotation&period;tutorial&semi; &NewLine; &NewLine;import org&period;springframework&period;beans&period;factory&period;annotation&period;Autowired&semi; &NewLine; &NewLine;public class Circle &NewLine;&lbrace; &NewLine; &sol;&sol;using autowired annotation with property &NewLine; &commat;Autowired&lpar;required&equals;false&rpar; &NewLine; private Point center&semi; &NewLine; &NewLine; public void setCenter&lpar;Point center&rpar; &NewLine; &lbrace; &NewLine; this&period;center &equals; center&semi; &NewLine; &rcub; &NewLine; &NewLine; public void draw&lpar;&rpar; &NewLine; &lbrace; &NewLine;System&period;out&period;println&lpar;"Circle is drawn of center &lpar;"&plus;center&period;getX&lpar;&rpar;&plus;"&comma; "&plus;center&period;getY&lpar;&rpar;&plus;"&rpar;"&rpar;&semi; &NewLine; &rcub; &NewLine;&rcub;<&sol;pre>&NewLine;<&sol;div>&NewLine;<p>&nbsp&semi;<&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;"><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;<p>&nbsp&semi;<&sol;p>&NewLine;<&sol;div>&NewLine;<p>&nbsp&semi;<&sol;p>&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;annotations-in-spring-and-based&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-required-annotation&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; '658'&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