Home » Tag Archives: Spring (page 13)

Tag Archives: Spring

Injecting authenticated user into Spring MVC @Controllers

spring-interview-questions-answers

Injecting injecting authenticated user into Spring MVC handler method can be done with @AuthenticationPrincipal annotation and AuthenticationPrincipalArgumentResolver that is an implementation of Spring MVS MethodArgumentResolver. AuthenticationPrincipalArgumentResolver is registered by default with web security configuration (e.g. when you enable security with @EnableWebSecurity). 1. Custom UserDetails Let’s assume we have our custom UserDetails implementation: import org.springframework.security.core.GrantedAuthority; import pl.codeleak.surveyapp.entities.Member; import java.util.Collection; public class ...

Read More »

RabbitMQ retries using Spring Integration

I recently read about an approach to retry with RabbitMQ here and wanted to try a similar approach with Spring Integration, which provides an awesome set of integration abstractions. TL;DR the problem being solved is to retry a message(in case of failures in processing) a few times with a large delay between retries(say 10 mins +). The approach makes use of ...

Read More »

Integrating with RabbitMQ using Spring Cloud Stream

spring-interview-questions-answers

In my previous post I wrote about a very simple integration scenario between two systems – one generating a work unit and another processing that work unit and how Spring Integration makes such integration very easy. Here I will demonstrate how this integration scenario can be simplified even further using Spring Cloud Stream I have the sample code available here – the right maven ...

Read More »

Deploy Spring Boot Application on Amazon Elastic Beanstalk

spring-interview-questions-answers

In this blog, we are going to see how to deploy a Spring boot application on Amazon ElasticBeanstalk. Amazon ElasticBeanstalk has a preconfigured Java environment, which could be used to deploy a Spring Boot JAR which has the servlet container inside it. For our example, we will use maven as the build tool here. Step 1 : The first step ...

Read More »

Spring Batch: Multiple Format Output Writer

spring-interview-questions-answers

Being a strong advocate of Spring Batch, I’ve always talked about the notion of Spring Batch providing developers with a framework that allows them to focus on solving business needs. By doing so, it allows developers to not spend an inordinate amount of time solving all of the technical aspects to support the solution. To illustrate what I mean by ...

Read More »

SpringOne Platform 2016 Retrospective

spring-interview-questions-answers

I recently wrapped up attending the SpringOne Platform conference in Las Vegas. This was my first time attending SpringOne; it was an experience listening to talks and having conversations with some of the top experts in software development. If you didn’t attend SpringOne, you’ll definitely want to read this post. We’ll go over these four themes and how to potentially ...

Read More »

Suppress FindBugs Warnings in a Java and Spring Boot Web Application using Gradle

How to Suppress FindBugs Warnings using Annotations in a +Spring Boot and +Java Application If your build is breaking because of a FindBugs issue and it is a false-positive or you are unable to resolve the issue because of other considerations, you can add an Annotation to ignore the Findbugs warning. Update your Gradle Dependencies You will want to add the following compile time ...

Read More »

Spring Integration – Polling file creation and modification

spring-interview-questions-answers

1 Introduction File support is another of Spring Integration’s endpoints to communicate with external systems. In this case, it provides several components to read, write and transform files. During this post, we are going to write an application which monitors a directory in order to read all files in there. In concrete it does the following: When the application starts, ...

Read More »