OPI Blog
Learn from experts in their fields

Browsing Tags: spring

Resetting Database Between Spring Integration Tests
When tasked with having to write an integration test or a Spring Webflux test that uses a database, it can be cumbersome to have to reset the database between each test by using @DirtiesContext. Using ...
Feb 2, 2021
Loading Local Test Data in Spring Boot
When working on an API, it can be nice to load some data locally on startup. This is especially true when working on a read-only endpoint where no REST API is available to POST any ...
Sep 3, 2020
Using Spring Beans in a Kafka Streams ExceptionHandler
There are many things to know before diving into Kafka Streams. If you haven’t already, check out these 5 things as a starting point. Bullet 2 mentions designing for exceptions. Ironically, this seems to be ...
May 21, 2019
Speed Up Spock Spring Tests
This article follows up some excellent info on testing Spring with Spock here and here. Developing with Spring and testing with Spock means you’re using two of the best tools available on the JVM today. ...
Testing with Spring Kafka and MockSchemaRegistryClient
Spring Kafka provides a variety of testing utilities to make writing integration tests easier. Most notably, the @EmbeddedKafka annotation spins up an embedded broker (and zookeeper) available for tests. The address of the broker is set to ...
Aug 7, 2018
Apache Kafka and Reactive Spring Boot
This post is a continuation of the two part series exploring Apache Ignite, Apache Kafka, and Reactive Spring Boot concepts. This part covers the use of Reactive Kafka consumers to return live database events to ...
Jul 26, 2018
Streaming Apache Ignite changes in Apache Kafka Topics
This is a two part series exploring Apache Ignite, Apache Kafka, and Reactive Spring Boot concepts. This part covers the setting up of Apache Ignite as a datasource and using Apache Kafka as a streaming ...
Spock 1.2 Annotations for Spring Integration Testing
@SpringBean, @SpringSpy, and @UnwrapAopProxy are new annotations in Spock 1.2 that make it easier to inject mocks into the Spring context when doing Integration testing. These can greatly simplify your code from using a @TestConfiguration ...
RestTemplate Status Code Handling
I was writing a  Spring Boot microservice that called an external service. If the service returned a `500`, the payload of the response had an error code that we wanted to send back to the ...
Dec 20, 2017
Dynamic SFTP Connection Factory for Spring Integration
I recently had the opportunity to dive into a Spring Integration project that presented an interesting challenge: the creation of a outbound SFTP Connection Factory at runtime based on Spring Batch jobs. In a simple ...