This post shows working code fragments that upload files from a web browser.
Spring Boot Asynchronous Controller Without External Queues
This post shows how to create an asynchronous web controller or endpoint in Spring Boot (or Spring in general). The codes won’t use external queues of any kind. However, they’ll use ThreadPoolTaskExecutor to run codes in the background without having
Spring Framework Basic AOP Example
AOP is one of those things in the Spring Framework that we might not need, even for basic implementation, which we have an example for in this post. But we should always consider using Spring AOP whenever possible to have
Spring Primary On Beans of a Class
We may not need the Spring Primary annotation on Beans of the same class, primarily when we use the @Bean annotation. When we have Java classes that implement the same interface, we will surely get the NoUniqueBeanDefinitionException exception. It happens
Spring Framework Minimum Dependency for IoC
Nowadays, most of us use Spring Boot, and we tend to skip the basics of the Spring Framework. Even those new to Spring would not think twice about turning to Spring Boot to develop new applications. Without Spring Boot, how
Easy Reflection using Spring ReflectionTestUtils
This post demonstrates how to get and set instance variables and invoke methods via the Reflection API using Spring ReflectionTestUtils. There are key reasons to do things via Reflection: 1) test non-public methods (not recommended, though), and 2) inaccessible instance variables (to mock).
Spring MVC PathVariable Annotation
Sometimes we want to send values to our web application as the path of the URL (or URI) path. For example, /tenants/123 where value 123 represents a tenant Id. To independently access the value in Spring MVC, we use the
Truncate MySQL Tables Before DBUnit Loads Data
This post shows how to truncate a table in MySQL before DbUnit loads data via @DatabaseSetup. Truncating the tables in the @Before method does not work because DBUnit loads the data first via @DatabaseSetup before delegating calls to a @Before
Using @Conditional with @Configuration in Spring
Using @Conditional with @Configuration in Spring allows us to group @Bean objects loaded on a specific condition without resorting to using @Profile and too many @Bean/@Conditional. Requirements We used the following items for this post. Spring Boot 2.0.4.RELEASE JDK 8
Spring Boot – Publish and Consume Custom Application Events
This post shows how to implement the Observer Design Pattern using the facilities available from Spring Application Events. More importantly, it shows how to publish and consume custom application events in Spring Boot. Observer Design Pattern – Publish And Consume