Spring MVC

In this short tutorial, I am going to share with you how to switch your Spring Boot app, at runtime, to use a different logging level. Set Logging Level for a Package in Your App Let’s assume we have a Spring Boot Web Application with the following method in a Rest Controller class. @RestController @RequestMapping(“/users”)…

Read More Switch Logging Level in Spring Boot at Runtime

In this tutorial, you will learn how to add a Social Login(OAuth 2) feature into your Spring MVC Web application. This will allow users to login to your application with their social network accounts like Facebook, Google, or other large services that support OAuth 2 like for example GitHub. Spring Security 5 offers very good…

Read More Spring Security OAuth 2 Social Login

In this tutorial, you will learn how to use @AuthenticationPrincipal annotation to get the Jwt object containing the details of a provided in HTTP Request access token. When we send a request containing an access token in the Authorization header, behind the scenes,  Spring Framework will do a lot of work and if all is good,…

Read More @AuthenticationPrincipal – Getting the Jwt Claims

By default, Spring Boot RESTful Web service endpoints consume and produce JSON representation. But we can easily make our RESTful Spring Boot Web service endpoints consume and produce an XML representation of a resource as well. Add XML Support to Spring Boot Project To make our Spring Boot project consume and produce an XML representation…

Read More Consuming XML in Spring Boot REST

HATEOAS is a way to make your RESTful Web Service endpoint, automatically include links to other Resources of your API, in the response that it sends back to a calling client application.  The client application that consumes your web service endpoint, can then use those links, to consume other RESTful Resources that your Web Service…

Read More Add HATEOAS to Spring Boot RESTful Web Service

In this Spring Security tutorial, you will learn how to use the @PreAuthorize annotation to secure method invocation. You can use the @PreAuthorize annotation to secure either method in a Controller class or a method in a service layer class. There are other useful method level security annotations like the ones below. It is useful…

Read More Spring Security @PreAuthorize Annotation Example

In this Spring Security tutorial, you will learn how to enable and use the Method Level Security with @Secured annotation. There are other useful method level security annotations like the ones below. It is useful to know how they work as well. @PostAuthorize Security Annotation Example, @PreAuthorize Security Annotation Example. If you are interested in video…

Read More Spring Security @Secured Annotation Example

In this short Spring Boot tutorial I am going to show you how use @Validated and @Email annotations to validate email address sent to a RESTful Web Service in HTTP GET Request. If you are looking for an example of how to validate email address sent in HTTP POST request, please have a look at my…

Read More Spring Boot – Validate Email in @RequestParam

In this tutorial, you will learn how to create a Web Service or a Microservice and how to make it register with Eureka Discovery Server. For a step by step series of video lessons, please check this page: Spring Boot Microservices and Spring Cloud. Start Eureka Discovery Server To be able to follow this tutorial…

Read More Register Web Service with Eureka Server

In this tutorial on Spring Framework you will learn how to use constructor-based dependency injection(DI) in Spring Framework when building RESTful Web Services. Injecting an Object Let’s assume we need to inject a Utility class into a Service class we have. Below is an example of a UserService class which uses Constructor-Based dependency injection to…

Read More Constructor-Based Dependency Injection in Spring

In this tutorial, you will learn how to use the @Autowired and @Qualifier annotations together to auto wire a specific Bean. Sometimes you might have more than one Bean of the same type and if you do not explicitly specify which one you would like to auto wire, you will get an NoUniqueBeanDefinitionException when starting up…

Read More How to Use @Autowired and @Qualifier in Spring

In this Spring MVC tutorial, you will learn how to read HTTP Request Header in the Rest Controller class of your Application. To read HTTP Request Header in Spring MVC application we use @RequestHeader annotation. @RequestHeader(value=”Accept”) String acceptHeader Reading HTTP Request Header For example, let’s assume we need to create a method in our Rest…

Read More Read HTTP Request Header in Spring MVC

Free Video Lessons

Enter your email and stay on top of things,

Subscribe!