I have a bean that contains two autowired instances of the same component:
@Component
public SomeBean {
@Autowired
private SomeOtherBean someOtherBean1;
@Autowired
private SomeOtherBean someOtherBean2;
...
}
SomeOtherBean has a prototype scope:
@Component
@Scope("prototype")
public SomeOtherBean {
@Value("...")
private String configurable;
}
The configurable value needs to be different for each autowired SomeOtherBean and will be supplied via a property placeholder:
configurable.1=foo
configurable.2=bar
Ideally I would like to use annotations to specify the value of the configurable property.
Doing this via XML would be easy but I would like to know whether this is
- a) impossible with annotations or
- b) how it can be done.