A Quick Guide to Spring Beans

Java beans? Nah Spring beans

What is Spring?

Photo by Boris Smokrovic on Unsplash

What is a Spring Bean?


What is a Spring Bean?

Photo by Volodymyr Hryshchenko on Unsplash

Bean Deep Dive

Bean Scope

<bean id="badassService" class="com.foo.bar" scope="singleton"/>
<bean id="badassService" class="com.foo.bar" scope="prototype"/>
Photo by Louis Hansel @shotsoflouis on Unsplash

Bean Life Cycle

Initalization and Destroy using XMLXML:
<bean id="badassService" class="com.foo.bar" scope="prototype"
init-method="intialize" destroy-method="clean"/>
public class Bar{
public void intialize(){
//This is my init method

public void clean(){
//this is my destroy method
<beans default-init-method="intialize">
<bean id="badassService" class="com.foo.bar"></bean>
Photo by Ivan Dostál on Unsplash

Bean Inheritance

<bean id="badassParentService" class="com.foo.bar"></bean>
<bean id="badassChildService" class="com.foo.childBar" parent="badassParentService"></bean>


Programmer Since 17. Currently working in front-end and mid-tier programming for a finance company. Check out my Tech blog @ documentobject.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store