Let's send a test request and see what response we get. The following screenshot shows the output:
The response for the http://localhost:8080/welcome-with-object URL is shown as follows:
{"message":"Hello World"}
The question that needs to be answered is this: how does the WelcomeBean object that we returned get converted into JSON?
Again, it's the magic of Spring Boot auto-configuration. If Jackson is on the classpath of an application, instances of the default object to JSON (and vice versa) converters are auto-configured by Spring Boot.