title: Inject this field value directly into "studentStepOne", the only method that uses it
body: <p>I've developed <strong>Spring Boot-Batch</strong> code and <code>sonarlint/Sonar-Qube</code> giving me below error. I went through the link, but solution is not understood as per this link: <a href="https://rules.sonarsource.com/java/tag/spring/RSPEC-3305" rel="nofollow noreferrer">https://rules.sonarsource.com/java/tag/spring/RSPEC-3305</a>.</p>
  
  <blockquote>
    <p>Inject this field value directly into "studentStepOne", the only method that uses it.</p>
  </blockquote>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>@Configuration
  @PropertySource("classpath:application.properties")
  public class StudentJob {
      @Value( "${spring.chunk.size}")
      private String chunkSize;
  
      @Autowired
      private JobBuilderFactory jobBuilderFactory;
  
      @Autowired
      private StepBuilderFactory stepBuilderFactory;
  
      @Autowired
      private JdbcCursorItemReader&lt;Student&gt; StudentReader;
  
      @Autowired
      private ItemProcessor&lt;Student, Student&gt; StudentProcessor;
  
      @Autowired
      private StudentWriter StudentWriter;
  
      @Bean
      public StudentStepExecuListner StudentStepExecuListner() {
          return new StudentStepExecuListner();
      }
  
      @Bean("readStudentJob")
      @Primary
      public Job readStudentJob() {
          return jobBuilderFactory.get("readStudentJob")
                  .incrementer(new RunIdIncrementer())
                  .start(StudentStepOne())
                  .build();
      }
  
      @Bean
      public Step StudentStepOne() {
          return stepBuilderFactory.get("StudentStepOne")
                  .&lt;Student, Student&gt;chunk(Integer.parseInt(chunkSize))
                  .reader(StudentReader)
                  .processor(StudentProcessor)
                  .writer(StudentWriter)
                  .listener(StudentStepExecuListner())
                  .build();
      }
  }
  </code></pre>