Changing a class annotated @Component to @Bean annotated method
<p>I have a class that is annotated <code>@Component</code> that was then <code>@Autowired</code> into another class.  However, I need to remove this <code>@Component</code> annotation and instead, create it with an <code>@Bean</code> annotated method in the class where its was previously autowired.</p>

<p>Where previously the classes looked like:</p>

<pre><code>@Component
public class MyClass implements IMyClass
{
    // Stuff
}

@Configuration
public class MyUsingClass
{
    @Autowired
    private IMyClass myClass;

    private void methodUsingMyClass()
    {
        myClass.doStuff();
    }
}
</code></pre>

<p>So now I have removed the <code>@Component</code> annotation and written a <code>@Bean</code> annotated method like this:</p>

<pre><code>public class MyClass implements IMyClass
{
    // Stuff
}

@Configuration
public class MyUsingClass
{
    @Bean
    public IMyClass getMyClass()
    {
        return new MyClass();
    }

    ....
}
</code></pre>

<p>My question is around replacing the previous call of <code>myClass.doStuff()</code> to use the new bean.  Do I now pass in a parameter of type <code>MyClass</code> to the private method:</p>

<pre><code>private void methodUsingMyClass(final MyClass myClass)
{
    myClass.doStuff();
}
</code></pre>

<p>... or do I call this method directly (doesn't seem the correct way to me):</p>

<pre><code>private void methodUsingMyClass()
{
    getMyClass().doStuff();
}
</code></pre>

<p>... or are neither of these correct?</p>