Skip to content

Commit 36d850d

Browse files
committed
Merge pull request #39389 from onobc
* pr/39389: Remove use of Pulsar ObjectMapperFactory Closes gh-39389
2 parents 976152b + 41ed4d6 commit 36d850d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/pulsar/PulsarPropertiesMapper.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
import java.util.concurrent.TimeUnit;
2424
import java.util.function.BiConsumer;
2525
import java.util.function.Consumer;
26+
import java.util.stream.Collectors;
2627

2728
import org.apache.pulsar.client.admin.PulsarAdminBuilder;
2829
import org.apache.pulsar.client.api.ClientBuilder;
2930
import org.apache.pulsar.client.api.ConsumerBuilder;
3031
import org.apache.pulsar.client.api.ProducerBuilder;
3132
import org.apache.pulsar.client.api.PulsarClientException.UnsupportedAuthenticationException;
3233
import org.apache.pulsar.client.api.ReaderBuilder;
33-
import org.apache.pulsar.common.util.ObjectMapperFactory;
3434

3535
import org.springframework.boot.context.properties.PropertyMapper;
3636
import org.springframework.pulsar.listener.PulsarContainerProperties;
@@ -87,7 +87,10 @@ private void customizeAuthentication(AuthenticationConsumer authentication,
8787
private String getAuthenticationParamsJson(Map<String, String> params) {
8888
Map<String, String> sortedParams = new TreeMap<>(params);
8989
try {
90-
return ObjectMapperFactory.create().writeValueAsString(sortedParams);
90+
return sortedParams.entrySet()
91+
.stream()
92+
.map((e) -> "\"%s\":\"%s\"".formatted(e.getKey(), e.getValue()))
93+
.collect(Collectors.joining(",", "{", "}"));
9194
}
9295
catch (Exception ex) {
9396
throw new IllegalStateException("Could not convert auth parameters to encoded string", ex);

0 commit comments

Comments
 (0)