From 39cad79b41b9bb604d82b632f9735102322ef6be Mon Sep 17 00:00:00 2001
From: Peeter Karolin <peeter.karolin@transferwise.com>
Date: Thu, 4 Apr 2024 16:19:33 +0300
Subject: [PATCH 1/2] Create BeanPostProcessor beans in static methods to avoid
 the autoconfiguration classes to be processed in bean post-processing phase
 and logging a warning.

---
 CHANGELOG.md                                                | 6 ++++++
 gradle.properties                                           | 2 +-
 .../common/entrypoints/EntryPointsAutoConfiguration.java    | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9324067..587f936 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres
 to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
+## [2.16.1] - 2024-04-04
+
+### Changed
+
+* Use static methods to create BeanPostProcessors.
+
 ## [2.16.0] - 2024-02-14
 
 ### Changed
diff --git a/gradle.properties b/gradle.properties
index 8a42493..b0f924b 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1 +1 @@
-version=2.16.0
+version=2.16.1
diff --git a/tw-entrypoints-starter/src/main/java/com/transferwise/common/entrypoints/EntryPointsAutoConfiguration.java b/tw-entrypoints-starter/src/main/java/com/transferwise/common/entrypoints/EntryPointsAutoConfiguration.java
index 9f5cf0b..3524045 100644
--- a/tw-entrypoints-starter/src/main/java/com/transferwise/common/entrypoints/EntryPointsAutoConfiguration.java
+++ b/tw-entrypoints-starter/src/main/java/com/transferwise/common/entrypoints/EntryPointsAutoConfiguration.java
@@ -56,7 +56,7 @@ public DatabaseAccessStatisticsEntryPointInterceptor twEntryPointsDatabaseAccess
   @Bean
   @ConditionalOnProperty(name = "tw-entrypoints.das.enabled", havingValue = "true", matchIfMissing = true)
   @ConditionalOnMissingBean
-  public DatabaseAccessStatisticsBeanPostProcessor twEntryPointsDatabaseAccessStatisticsBeanPostProcessor() {
+  public static DatabaseAccessStatisticsBeanPostProcessor twEntryPointsDatabaseAccessStatisticsBeanPostProcessor() {
     return new DatabaseAccessStatisticsBeanPostProcessor();
   }
 

From db5238832785af138f2998a3fd79e31d2423c9c7 Mon Sep 17 00:00:00 2001
From: Peeter Karolin <peeter.karolin@transferwise.com>
Date: Thu, 4 Apr 2024 16:27:51 +0300
Subject: [PATCH 2/2] Create BeanPostProcessor beans in static methods to avoid
 the autoconfiguration classes to be processed in bean post-processing phase
 and logging a warning.

---
 .../common/entrypoints/EntryPointsAutoConfiguration.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tw-entrypoints-starter/src/main/java/com/transferwise/common/entrypoints/EntryPointsAutoConfiguration.java b/tw-entrypoints-starter/src/main/java/com/transferwise/common/entrypoints/EntryPointsAutoConfiguration.java
index 3524045..0bdac0e 100644
--- a/tw-entrypoints-starter/src/main/java/com/transferwise/common/entrypoints/EntryPointsAutoConfiguration.java
+++ b/tw-entrypoints-starter/src/main/java/com/transferwise/common/entrypoints/EntryPointsAutoConfiguration.java
@@ -63,7 +63,7 @@ public static DatabaseAccessStatisticsBeanPostProcessor twEntryPointsDatabaseAcc
   @Bean
   @ConditionalOnProperty(name = "tw-entrypoints.tas.enabled", havingValue = "true", matchIfMissing = true)
   @ConditionalOnMissingBean
-  public TableAccessStatisticsBeanPostProcessor twEntryPointsTableAccessStatisticsBeanPostProcessor(BeanFactory beanFactory) {
+  public static TableAccessStatisticsBeanPostProcessor twEntryPointsTableAccessStatisticsBeanPostProcessor(BeanFactory beanFactory) {
     return new TableAccessStatisticsBeanPostProcessor(beanFactory);
   }
 
@@ -105,7 +105,7 @@ public TasFlywayConfigurationCustomizer tasFlywayConfigurationCustomizer() {
   @Bean
   @ConditionalOnProperty(name = "tw-entrypoints.ts.enabled", havingValue = "true", matchIfMissing = true)
   @ConditionalOnMissingBean
-  public TransactionStatisticsBeanPostProcessor twEntryPointsTransactionStatisticsBeanPostProcessor(BeanFactory beanFactory) {
+  public static TransactionStatisticsBeanPostProcessor twEntryPointsTransactionStatisticsBeanPostProcessor(BeanFactory beanFactory) {
     return new TransactionStatisticsBeanPostProcessor(beanFactory);
   }