Skip to content

Commit

Permalink
Clarify the addition of the JSON dependency
Browse files Browse the repository at this point in the history
Insist that there's some action to be made.
  • Loading branch information
zapek authored Jul 22, 2024
1 parent e7d19ac commit 8f56ac4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ include::https://raw.githubusercontent.com/spring-guides/getting-started-macros/

For clarity, we have also defined a `myFactory` bean that is referenced in the `JmsListener` annotation of the receiver. Because we use the `DefaultJmsListenerContainerFactoryConfigurer` infrastructure provided by Spring Boot, that `JmsMessageListenerContainer` is identical to the one that Spring Boot creates by default.

The default `MessageConverter` can convert only basic types (such as `String`, `Map`, `Serializable`), and our `Email` is not `Serializable` on purpose. We want to use Jackson and serialize the content to JSON in text format (that is, as a `TextMessage`). Spring Boot detects the presence of a `MessageConverter` and associates it to both the default `JmsTemplate` and any `JmsListenerContainerFactory` created by `DefaultJmsListenerContainerFactoryConfigurer`. Our JSON converter needs the `spring-boot-starter-json` dependency.
The default `MessageConverter` can convert only basic types (such as `String`, `Map`, `Serializable`), and our `Email` is not `Serializable` on purpose. We want to use Jackson and serialize the content to JSON in text format (that is, as a `TextMessage`). Spring Boot detects the presence of a `MessageConverter` and associates it to both the default `JmsTemplate` and any `JmsListenerContainerFactory` created by `DefaultJmsListenerContainerFactoryConfigurer`. Our JSON converter needs adding the following dependency: `org.springframework.boot:spring-boot-starter-json`.

`JmsTemplate` makes it simple to send messages to a JMS destination. In the `main` runner method, after starting things up, you can use `jmsTemplate` to send an `Email` POJO. Because our custom `MessageConverter` has been automatically associated to it, a JSON document is generated in a `TextMessage` only.

Expand Down

0 comments on commit 8f56ac4

Please sign in to comment.