Home » Tag Archives: Spring

Tag Archives: Spring

How to Set Up a Secure REST API with Spring

spring-interview-questions-answers

As you all know, Spring Boot is a toolkit that makes it super easy to quickly develop powerful web services. It is very modular and made to play well with other frameworks and tools. In this tutorial I am going to show you how easy it is to set up a RESTful API towards an existing SQL database by using ...

Read More »

Spring Boot and Security Events with Actuator

spring-interview-questions-answers

Spring Boot Actuator provides auditing capabilities for publishing and listening to security related events in a Spring Boot application with Spring Security enabled. The default events are authentication success, authentication failure and access denied, but they can be extended with custom events. Make sure you have Spring Boot Security and Actuator enabled in your project <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> ...

Read More »

Consumer Driven Testing with Pact & Spring Boot

spring-interview-questions-answers

Recently a colleague of mine stumbled across Pact.io,  Our current application had grown to over 50 services and we we’re starting to have some integration test failures and a brittle dev / acceptance test environment. So we decided to have a look at ways to try help with this. I started out by reading: https://docs.pact.io/faq/convinceme.html Then watching: https://www.youtube.com/watch?v=-6x6XBDf9sQ&feature=youtu.be Those 2 resources convinced me ...

Read More »

Beware of slow transaction callbacks in Spring

spring-interview-questions-answers

TL;DR If your application is failing to obtain new database connection, restarting ActiveMQ broker may help. Interested? The problem with performance Few months ago we experienced a production outage. Many requests were failing with all too familiar: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 30003ms. at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:555) ~[HikariCP-2.4.7.jar:na] at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:188) ~[HikariCP-2.4.7.jar:na] at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:147) ~[HikariCP-2.4.7.jar:na] at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:99) ...

Read More »

Pipeline as code with a Spring Boot application

spring-interview-questions-answers

This is the last in a serie of posts about continuous delivery based on my local Docker compose stack (see the first and second post here). In this post I use a simple Spring Boot project to show how to make use of the ‘pipeline as code‘ concept. Please note that this is only an example and much, much more ...

Read More »

Spring Boot – Configure Log Level in runtime using actuator endpoint

spring-interview-questions-answers

As of Spring Boot 1.5 a new loggers actuator endpoint allows viewing and changing application logging levels in runtime. Add spring-boot-actuator to your project <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> Disable security for loggers or for all endpoints Set either management.security.enabled to false or endpoints.loggers.sensitive to false to disable security. Note that the latter changes only loggers endpoint. Get all loggers details ...

Read More »

Spring Data with JPA and @NamedQueries

spring-interview-questions-answers

If you use Spring Data and @NamedQuery annotations at your JPA entity you can easily use them in a more convenient way using the spring data repository. On a previous blog we created a spring data project using spring boot and docker. We will use the pretty same project and enhance our repository’s functionality. We will implement a named query ...

Read More »

Spring Tutorial: Creating a Hello World REST API Using Spring Framework and Spring Boot

spring-interview-questions-answers

Spring Framework was created as a result of disappointment of Java community with earlier versions of Enterprise Java. Since then it has grown into huge ecosystem that allows one to solve every problem in building a Web-based Java application and more. Spring is often criticized because it used to rely on XML for configuration purposes. As a response to that ...

Read More »

Push Spring Boot Docker images on ECR

On a previous blog we integrated a spring boot application with EC2. It is one of the most raw forms of deployment that you can have on Amazon Web Services. On this tutorial we will create a docker image with our application which will be stored to the Amazon EC2 container registry. You need to have the aws cli tool ...

Read More »

Want to take your Java skills to the next level?

Grab our programming books for FREE!

Here are some of the eBooks you will get:

  • Spring Interview QnA
  • Multithreading & Concurrency QnA
  • JPA Minibook
  • JVM Troubleshooting Guide
  • Advanced Java
  • Java Interview QnA
  • Java Design Patterns