Spring @RequestAttribute annotation – Spring MVC

Spring 4.3 provides a new @RequestAttribute annotation that helps us access to pre-existing global request attributes (outside the controller). Today we’re gonna look at how to get a HttpServletRequest attribute which is created in an Interceptor using Spring @RequestAttribute annotation.

Related Articles:
How to use SpringMVC HandlerInterceptor with Spring Boot
Spring @SessionAttribute annotation – Spring MVC

[Continue reading…] “Spring @RequestAttribute annotation – Spring MVC”

Spring @SessionAttribute annotation – Spring MVC

Spring 4.3 provides a new @SessionAttribute annotation that helps us access to pre-existing global session attributes (outside the controller). Today we’re gonna look at how to get a HttpSession attribute which is created in an Interceptor using Spring @SessionAttribute annotation.

Related Articles:
How to use SpringMVC HandlerInterceptor with Spring Boot
Spring @RequestAttribute annotation – Spring MVC

[Continue reading…] “Spring @SessionAttribute annotation – Spring MVC”

Spring Bean Scope Annotation: @RequestScope | @SessionScope | @ApplicationScope

Spring Framework new release 4.3 make some Web Improvements. Among that, it simplifies way to implement Bean Scopes (Request, Session and Application scopes) using Annotation: @RequestScope | @SessionScope | @ApplicationScope. They are only valid in the context of a web-aware Application.

Related Articles:
Spring Bean Scope – Singleton and Prototype
Spring Bean Scope using Annotation – Singleton, Prototype, Request, Session, Global Session, Application

[Continue reading…] “Spring Bean Scope Annotation: @RequestScope | @SessionScope | @ApplicationScope”

Spring JPA – Many to Many relationship

This tutorial will guide you through the steps configuring Many to Many relationship in database with Spring JPA, Spring Boot & PostgreSql.

Related articles:
How to configure Spring JPA One to One Relationship – SpringBoot
How to configure Spring JPA One to Many Relationship – SpringBoot
Spring Data Rest – How to create a RestAPIs with JPA Many-to-Many relational entities | SpringBoot + MySql + HAL Browser

[Continue reading…] “Spring JPA – Many to Many relationship”

@Resource Annotation in Spring

@Resource Annotation is used to indicate a reference to a resource, it is considered an alternative to @Autowired which is an Spring standard. Similar to Java EE 5, we can use @Resource Annotation with field injection or setter method.

This tutorial will cover those kinds of injection which will be used for matching by Name, Type or Qualifier.

[Continue reading…] “@Resource Annotation in Spring”

Difference between annotation-config and component-scan

annotation-config and component-scan are important basic concepts of Spring Core.
This tutorial helps you understand how to use them and difference between them.

[Continue reading…] “Difference between annotation-config and component-scan”

Spring Stereotype Annotations – Difference between @Service and @Repository

Spring provides some stereotype annotations, among them, @Service and @Repository are special cases of @Component for specific purposes. By annotating component classes with @Service, @Repository, your classes are more clear, thus, Spring will automatically scan and import those beans into the container, so we don’t need to define them using XML.

This tutorial show you overview of Repository Pattern & a Service Layer, as well as difference between @Service & @Repository.

[Continue reading…] “Spring Stereotype Annotations – Difference between @Service and @Repository”

Spring Bean Scope using Annotation – Singleton, Prototype, Request, Session, Global Session, Application

The tutorial shows you the way to implement Bean Scopes (Singleton, Prototype, Request and Session) using Annotation @Scope. Except Singleton and Prototype Scope, the others are only valid in the context of a web-aware Application.

Related Article: Spring Bean Scope – Singleton and Prototype

[Continue reading…] “Spring Bean Scope using Annotation – Singleton, Prototype, Request, Session, Global Session, Application”