title: How to pass parameter to a @Component class which can't be autowired in Spring Boot
body: <p>I am building a desktop application using JavaFx and Spring Boot and I am stuck at some problem</p>
  <p>I have <code>@Component</code> class <code>Translator</code> which extends <code>Task&lt;String&gt;</code> and makes an api call to google translation api and I want to pass an autowired bean class and some string parameters such as source and target language to the <code>Translator</code> constructor.</p>
  <pre><code>@Component
  class Translator extends Task&lt;String&gt;{
  
     private TextPreprocessor textPreprocessor;
     private Stirng strUrl;
     private String from;
     private String to;
     private String text;
  
     public Translator(@Value(&quot;${translator.api.url}&quot; strUrl,TextPreprocessor textPreprocessor)){
        this.strUrl=strUrl;
        this.textPreprocessor=textPreprocessor;
     }
  
     protected String call() throws Exception{
      //some code 
     }
  
  
  }
  @Component
  class TextPreprocessor{
   //some code
  }
  
  </code></pre>
  <p>So my problem is I need to pass parameters <code>from</code>,<code>to</code> and <code>text</code> to Translator constructor but I can't do that here because these varibles can't be autowired. How can I fix this?</p>