Spring annotation in Grails 3

I was recently working on a grails project and found that it is possible to read the configuration/properties defined in application.yml using spring annotation in Grails 3. Its possible in Grails 3 because it uses Spring boot under the hood. Here is an example:...

Spring Bean Life Cycle

Good Evening Folks. Every Java developer knows that at the time of creation of any object if some initialization is required we keep in constructor. Example. Class Math{ Math(){ // initialization code } } When it comes to J2EE Technology like Servlet we can do same...

Spring static factory method

Good Evening Folks. Today we will deal with a situation where we need an Object in our Spring bean class which can not be created with normal spring bean configuration tag. Lets take a example where requirement is we need inject an object inside my spring bean and...

Inject service inside the src classes

Inject service inside the src classes Note: A service can be injected inside only those classes which are the Spring Beans. This blog for injecting the service inside the src/groovy classes. To inject the service we need to know about two spring Annotations 1)...

Using Spring’s Java based configuration.

Using Spring’s Java based configuration is fairly straightforward and more flexible. In order to do it, you will have to annotate your java class, that is going to contain your beans, with @Configuration and as we have added the component-scan in our one post...