Updin thefor theg Springtime Study Other people wasn’t effortless, however, that had absolutely nothing to do with Spring Investigation Other people in itself

However, it may not add up to do this. I cannot query the fresh builders as to the reasons it had been done so means, they’re not here anymore. So it project’s facts is only able to be told the help of its Git record.

Coaching read upgrading Springtime Investigation Other people

We think our company is playing with SalvadoreГ±o mujer saliendo hombre blanco Spring Analysis Other people incorrect, incorrectly combo WebMVC rules. Whenever we had not done so right from the start, something could have work with far convenient.

We are today carried out with new Spring Investigation Other individuals migration. It is the right time to move to our very own next Springtime module, Spring Kafka.

Spring Kafka

Springtime Kafka, or rather Spring having Apache Kafka , is an excellent answer to have fun with Kafka on the Spring strategies. It gives easy-to-fool around with layouts for sending texts and you will normal Spring season annotations to own taking texts.

Configuring new people

step step one [ERROR] coffee.lang.IllegalStateException: Did not stream ApplicationContext 2 3 For the reason that: org.springframework.kidney beans.warehouse.BeanCreationException: Error carrying out bean which have term 'consumerFactory' defined in group path money [ de / app / config / KafkaConsumerConfig . class ]: 4 5 Caused by: java . lang . NullPointerException six at java . ft / java . util . concurrent . ConcurrentHashMap . putVal ( ConcurrentHashMap . java: 1011 ) seven at java . base / java . util . concurrent . ConcurrentHashMap . init >( ConcurrentHashMap . java: 852 ) 8 at org . springframework . kafka . key . DefaultKafkaConsumerFactory . init >( DefaultKafkaConsumerFactory . java: 125 ) nine at org . springframework . kafka . core . DefaultKafkaConsumerFactory . init >( DefaultKafkaConsumerFactory . java: 98 ) 10 at de . app . config . KafkaConsumerConfig . consumerFactory ( AbstractKafkaConsumerConfig . java: 120 ) 

It turns out, we had been configuring the consumerConfigs bean and setting null values in its properties. The following change from HashMap to ConcurrentHashMap means we can no longer configure null values. We refactored our code and now tests are green. Easy-peasy.

Kafka messages which have JsonFilter


1 [ERROR] org .apache .kafka mon .problems .SerializationException : Is also 't serialize investigation [Enjoy [payload=MyClass(Id=201000000041600097, . ] having topic [my-topic] 2 3 Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Don't manage PropertyFilter with id ‘myclassFilter' ; zero FilterProvider configured (compliment of site strings: de .try .Feel [ "payload" ] ) 4 within com .fasterxml .jackson .databind .exc .InvalidDefinitionException .out of (InvalidDefinitionException .coffee : 77 ) 

Some of our Java Beans use ato manipulate the serialization and deserialization. This requires a propertyFilter to be configured on the ObjectMapper.
Spring for Apache Kafka made a change to the JsonSerializer , introducing an ObjectWriter . When the ObjectWriter instance is created, the ObjectMapper configuration is copied, not referenced. Our test case was re-configuring the ObjectMapper with the appropriate propertyFilter after the ObjectWriter instance was created. Hence, the ObjectWriter didn't know anything about the propertyFilter (since the configuration was already copied). After some refactoring, changing how we create and configure the JsonSerializer , our test cases were green.
Running our build $ mvn clean verify finally resulted in a green build. Everything is working as it should. We pushed our changes to Bitbucket and everything built like a charm.

Coaching read updating Springtime Kafka


Courses discovered through the Springtime Boot up-date


Spring and Spring Boot do a great job documenting their releases, their release notes are well maintained. That being said, upgrading was challenging, it took quite a while before everything was working again. A big part of that is on us, for not following best practices, guidelines, etc. A lot of this code was written when the team was just starting out with Spring and Spring Boot. Code evolves over time, without refactoring and applying those latest practices. Eventually that catches up with you, but we use this as a learning experience and improved things. Our test cases are now significantly better, and we'll keep a closer eye on them moving forward.