How do I prefix each bean id in a package (inc. sub-packages) with a constant string in Spring?
<p>Is there a way to prefix each bean annotated with <code>@Component</code> in a certain package and subpackages with a given string?</p>

<p>Say, we have this bean, for example:</p>

<pre><code>package com.example.foo;

@Component
class MyBean {}
</code></pre>

<p>I want all beans in <code>foo</code> to be prefixed with <code>foo</code>, so that the automatically (by component scan) generated bean id is either <code>fooMyBean</code> (preferred, with capital 'M') or <code>foo-myBean</code> (instead of the default <code>myBean</code>). (The prefix being a String defined somewhere, not being automatically derived from the package name.)</p>

<p>Alternatively, can I achieve this by using custom annotations, like <code>@FooComponent</code>, say? (How? ;-) )</p>