Update kafka-component.adoc (#2474)

* Update kafka-component.adoc

* Improve the spring example

Add @PostConstruct method

* Improve Spring Example

using initMethod  and destroyMethod  @Bean(name = "offsetRepo", initMethod = "start", destroyMethod = "stop")
diff --git a/components/camel-kafka/src/main/docs/kafka-component.adoc b/components/camel-kafka/src/main/docs/kafka-component.adoc
index 4604e9c..949f36a 100644
--- a/components/camel-kafka/src/main/docs/kafka-component.adoc
+++ b/components/camel-kafka/src/main/docs/kafka-component.adoc
@@ -236,6 +236,26 @@
     }
 });
 ----------------------------------------------------------------------------------------------------------------------------
+[source,java]
+----------------------------------------------------------------------------------------------------------------------------
+// Create the repository in which the Kafka offsets will be persisted using Spring @Bean annotation
+@Bean(name = "offsetRepo", initMethod = "start", destroyMethod = "stop")
+private FileStateRepository fileStateRepository() {
+        FileStateRepository fileStateRepository = FileStateRepository.fileStateRepository(new File("/path/to/repo.dat"));
+        return fileStateRepository;
+}
+
+camelContext.addRoutes(new RouteBuilder() {
+    @Override
+    public void configure() throws Exception {
+        from("kafka:" + TOPIC + "?brokers=localhost:{{kafkaPort}}" +
+                     "&groupId=A" +                            //
+                     "&autoOffsetReset=earliest" +             // Ask to start from the beginning if we have unknown offset
+                     "&offsetRepository=#offsetRepo")          // Keep the offsets in the previously configured repository
+                .to("mock:result");
+    }
+});
+----------------------------------------------------------------------------------------------------------------------------
  
 
 #### Producing messages to Kafka