Skip to content

Commit 310156d

Browse files
authored
Merge pull request #257 from SourceLabOrg/spp/sbUpgrade
Upgrade from Springboot 2.1 to 2.6
2 parents 2886598 + d6c7dce commit 310156d

File tree

8 files changed

+59
-39
lines changed

8 files changed

+59
-39
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
The format is based on [Keep a Changelog](http://keepachangelog.com/)
33
and this project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## 2.9.0 (UNRELEASED)
6+
#### Internal Dependency Updates
7+
- Upgrade from SpringBoot 2.1.18 to 2.6.1.
8+
59
## 2.8.2 (12/19/2021)
610
#### Bug Fixes
711
- Disable flyway migration validation due to botched update of existing migration file, which prevented startup when updating from older versions.

dev-cluster/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<parent>
66
<artifactId>kafka-webview</artifactId>
77
<groupId>org.sourcelab</groupId>
8-
<version>2.8.2</version>
8+
<version>2.9.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>dev-cluster</artifactId>
13-
<version>2.8.2</version>
13+
<version>2.9.0-SNAPSHOT</version>
1414

1515
<!-- Require Maven 3.3.9 -->
1616
<prerequisites>

kafka-webview-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.sourcelab</groupId>
77
<artifactId>kafka-webview</artifactId>
8-
<version>2.8.2</version>
8+
<version>2.9.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<artifactId>kafka-webview-plugin</artifactId>

kafka-webview-ui/pom.xml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
<parent>
66
<artifactId>kafka-webview</artifactId>
77
<groupId>org.sourcelab</groupId>
8-
<version>2.8.2</version>
8+
<version>2.9.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111
<artifactId>kafka-webview-ui</artifactId>
12-
<version>2.8.2</version>
12+
<version>2.9.0-SNAPSHOT</version>
1313

1414
<!-- Module Description and Ownership -->
1515
<name>Kafka WebView UI</name>
@@ -62,7 +62,7 @@
6262
</dependency>
6363
<dependency>
6464
<groupId>org.thymeleaf</groupId>
65-
<artifactId>thymeleaf-spring4</artifactId>
65+
<artifactId>thymeleaf-spring5</artifactId>
6666
<version>${thymeleaf.version}</version>
6767
</dependency>
6868
<dependency>
@@ -73,7 +73,7 @@
7373
<dependency>
7474
<groupId>nz.net.ultraq.thymeleaf</groupId>
7575
<artifactId>thymeleaf-layout-dialect</artifactId>
76-
<version>2.5.3</version>
76+
<version>3.0.0</version>
7777
</dependency>
7878
<dependency>
7979
<groupId>org.thymeleaf.extras</groupId>
@@ -125,6 +125,13 @@
125125
<groupId>org.springframework.boot</groupId>
126126
<artifactId>spring-boot-starter-actuator</artifactId>
127127
</dependency>
128+
129+
<!-- Validation Framework and annotations -->
130+
<dependency>
131+
<groupId>org.springframework.boot</groupId>
132+
<artifactId>spring-boot-starter-validation</artifactId>
133+
</dependency>
134+
128135
<!-- Micrometer Prometheus registry -->
129136
<dependency>
130137
<groupId>io.micrometer</groupId>
@@ -140,7 +147,7 @@
140147
<dependency>
141148
<groupId>javax.xml.bind</groupId>
142149
<artifactId>jaxb-api</artifactId>
143-
<version>2.3.0</version>
150+
<version>2.3.1</version>
144151
</dependency>
145152

146153
<!-- Allows for auto-reloading resources -->
@@ -201,14 +208,13 @@
201208
</exclusion>
202209
</exclusions>
203210
</dependency>
204-
<!-- Explicitly include updated version -->
205-
<dependency>
206-
<groupId>org.apache.commons</groupId>
207-
<artifactId>commons-compress</artifactId>
208-
<version>1.21</version>
209-
</dependency>
210211

211212
<!-- For tests -->
213+
<dependency>
214+
<groupId>org.junit.vintage</groupId>
215+
<artifactId>junit-vintage-engine</artifactId>
216+
<scope>test</scope>
217+
</dependency>
212218
<dependency>
213219
<groupId>org.springframework.boot</groupId>
214220
<artifactId>spring-boot-starter-test</artifactId>

kafka-webview-ui/src/main/java/org/sourcelab/kafka/webview/ui/configuration/PluginConfig.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import org.sourcelab.kafka.webview.ui.manager.plugin.UploadManager;
4242
import org.sourcelab.kafka.webview.ui.manager.sasl.SaslUtility;
4343
import org.sourcelab.kafka.webview.ui.plugin.filter.RecordFilter;
44-
import org.springframework.beans.factory.annotation.Autowired;
4544
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
4645
import org.springframework.context.annotation.Bean;
4746
import org.springframework.stereotype.Component;
@@ -104,7 +103,11 @@ public SecretManager getSecretManager(final AppProperties appProperties) {
104103
* @return Web Kafka Consumer Factory instance.
105104
*/
106105
@Bean
107-
public WebKafkaConsumerFactory getWebKafkaConsumerFactory(final AppProperties appProperties, final KafkaClientConfigUtil configUtil) {
106+
public WebKafkaConsumerFactory getWebKafkaConsumerFactory(
107+
final AppProperties appProperties,
108+
final KafkaClientConfigUtil configUtil,
109+
final SecretManager secretManager
110+
) {
108111
final ExecutorService executorService;
109112

110113
// If we have multi-threaded consumer option enabled
@@ -126,22 +129,22 @@ public WebKafkaConsumerFactory getWebKafkaConsumerFactory(final AppProperties ap
126129
return new WebKafkaConsumerFactory(
127130
getDeserializerPluginFactory(appProperties),
128131
getRecordFilterPluginFactory(appProperties),
129-
getSecretManager(appProperties),
132+
secretManager,
130133
getKafkaConsumerFactory(configUtil),
131134
executorService
132135
);
133136
}
134137

135138
/**
136139
* For creating Kafka operational consumers.
137-
* @param appProperties Definition of app properties.
138140
* @param configUtil Utility for configuring kafka clients.
141+
* @param secretManager For managing secrets.
139142
* @return Web Kafka Operations Client Factory instance.
140143
*/
141144
@Bean
142-
public KafkaOperationsFactory getKafkaOperationsFactory(final AppProperties appProperties, final KafkaClientConfigUtil configUtil) {
145+
public KafkaOperationsFactory getKafkaOperationsFactory(final KafkaClientConfigUtil configUtil, final SecretManager secretManager) {
143146
return new KafkaOperationsFactory(
144-
getSecretManager(appProperties),
147+
secretManager,
145148
getKafkaAdminFactory(configUtil)
146149
);
147150
}
@@ -158,11 +161,6 @@ public Jackson2ObjectMapperBuilderCustomizer registerJacksonProtobufModule() {
158161
};
159162
}
160163

161-
@Autowired(required = true)
162-
public void configureJackson(ObjectMapper jackson2ObjectMapper) {
163-
jackson2ObjectMapper.registerModule(new ProtobufModule());
164-
}
165-
166164
/**
167165
* For creating instances of AdminClient.
168166
*/

kafka-webview-ui/src/main/resources/config/base.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ management:
6060
metrics:
6161
tags:
6262
application: ${spring.application.name}
63-
## Disable LDAP by default
6463
health:
64+
## Enable probes to get liveness and readiness checks for kubernetes
65+
## See https://spring.io/blog/2020/03/25/liveness-and-readiness-probes-with-spring-boot
66+
probes:
67+
enabled: false
68+
## Disable LDAP by default
6569
ldap:
6670
enabled: false
6771

@@ -81,8 +85,10 @@ app:
8185
consumerIdPrefix: "KafkaWebViewConsumer"
8286
requireSsl: true
8387
user:
88+
## By default, require user authentication.
8489
enabled: true
85-
## Ldap auth settings
90+
91+
## Example Ldap auth settings, disabled by default.
8692
ldap:
8793
enabled: false
8894
userDnPattern: "uid={0},ou=people"

kafka-webview-ui/src/test/java/org/sourcelab/kafka/webview/ui/manager/kafka/dto/ConsumerGroupOffsetsTest.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,16 @@ public void testBuilder() {
9292

9393
/**
9494
* Validates the object serializes to json correctly.
95+
*
96+
* NOTE: Not exactly the best test, it appears as tho the serialization order of the properties isn't exactly
97+
* deterministic... so we jump thru some hoops here for the validation assertion.
9598
*/
9699
@Test
97100
public void testSerialization() throws JsonProcessingException {
98101
// Define our expected output.
99-
final String expectedResult = "{\"consumerId\":\"MyConsumerId\",\"topics\":[{\"topic\":\"topic-a\",\"partitions\":[0,1],\"offsets\":[{\"partition\":0,\"offset\":0},{\"partition\":1,\"offset\":1}]},{\"topic\":\"topic-b\",\"partitions\":[0,1],\"offsets\":[{\"partition\":0,\"offset\":2},{\"partition\":1,\"offset\":3}]}],\"topicNames\":[\"topic-a\",\"topic-b\"]}";
102+
// Looks like the order of properties is undetermined... so to avoid flapping test lets check each possible variation... :/
103+
final String expectedResult1 = "{\"consumerId\":\"MyConsumerId\",\"topics\":[{\"topic\":\"topic-a\",\"partitions\":[0,1],\"offsets\":[{\"partition\":0,\"offset\":0},{\"partition\":1,\"offset\":1}]},{\"topic\":\"topic-b\",\"partitions\":[0,1],\"offsets\":[{\"partition\":0,\"offset\":2},{\"partition\":1,\"offset\":3}]}],\"topicNames\":[\"topic-a\",\"topic-b\"]}";
104+
final String expectedResult2 = "{\"consumerId\":\"MyConsumerId\",\"topics\":[{\"topic\":\"topic-a\",\"offsets\":[{\"partition\":0,\"offset\":0},{\"partition\":1,\"offset\":1}],\"partitions\":[0,1]},{\"topic\":\"topic-b\",\"offsets\":[{\"partition\":0,\"offset\":2},{\"partition\":1,\"offset\":3}],\"partitions\":[0,1]}],\"topicNames\":[\"topic-a\",\"topic-b\"]}";
100105

101106
final ConsumerGroupOffsets offsets = ConsumerGroupOffsets.newBuilder()
102107
.withConsumerId("MyConsumerId")
@@ -113,6 +118,14 @@ public void testSerialization() throws JsonProcessingException {
113118
final String result = objectMapper.writeValueAsString(offsets);
114119

115120
// Validate
116-
assertEquals("Should have expected serialized value", expectedResult, result);
121+
if (expectedResult1.equals(result)) {
122+
assertEquals("Should have expected serialized value", expectedResult1, result);
123+
} else if (expectedResult2.equals(result)) {
124+
assertEquals("Should have expected serialized value", expectedResult2, result);
125+
} else {
126+
// This will fail.....
127+
System.out.println("Got:" + result);
128+
assertEquals("Should have expected serialized value", expectedResult1, result);
129+
}
117130
}
118131
}

pom.xml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>org.sourcelab</groupId>
88
<artifactId>kafka-webview</artifactId>
99
<packaging>pom</packaging>
10-
<version>2.8.2</version>
10+
<version>2.9.0-SNAPSHOT</version>
1111

1212
<!-- Define submodules -->
1313
<modules>
@@ -57,17 +57,10 @@
5757
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5858
<java.version>1.8</java.version>
5959

60-
<!-- Override logback version for security fix -->
60+
<!-- Override versions for security fixes -->
6161
<!-- https://github.com/spring-projects/spring-boot/issues/8635 -->
6262
<logback.version>1.2.8</logback.version>
63-
64-
<!-- Override versions for security fixes -->
65-
<!-- To be removed when upgrading to newer springboot releases -->
66-
<jackson.version>2.13.0</jackson.version>
67-
<hibernate.version>5.3.24.Final</hibernate.version>
6863
<tomcat.version>9.0.56</tomcat.version>
69-
<snakeyaml.version>1.29</snakeyaml.version>
70-
<groovy.version>2.5.15</groovy.version>
7164

7265
<!-- test toggling -->
7366
<skipTests>false</skipTests>
@@ -80,7 +73,7 @@
8073
<parent>
8174
<groupId>org.springframework.boot</groupId>
8275
<artifactId>spring-boot-starter-parent</artifactId>
83-
<version>2.1.18.RELEASE</version>
76+
<version>2.6.1</version>
8477
</parent>
8578

8679
<dependencies>

0 commit comments

Comments
 (0)