I'm relatively new to Spring, but I'm a big fan of dependency injection and have used Google Guice for quite a while now. So forgive me if this might turn out to be newbie question...
One of the great things about DI, in my mind, is that you can get rid of a lot of boiler plate code that essentially just copies data around, like the good old setter methods:
With Guice or JSR-330, this can be simplified to
public void setSomeProperty(SomeProperty property)
this.property = property;
Our application uses the application-context.xml to wire everything, and one of the beans is set up like this:
@Inject SomeProperty property;
The only way I can make this work properly seems to be by adding a setter method setEnvelopeManager(EnvelopeManager) to the bean, which introduces exactly the kind of boiler plate code that I'm trying to avoid. First, I tried using the @Autowired on the property field, but then I realized that it's not really autowired, since the bean is configured with a specific property. We're also using JAX-RS and Apache CXF, so I tried an @Context annotation as well, also to no avail.
<bean id="fpcaWebService" class="com.everyonecounts.fpca.admin.impl.FPCAWebServiceImpl">
<property name="envelopeManager" ref="fpcaEnvelopeManager"/>
As the JSR-330 API is not on our build path, I haven't tried @Inject yet, but before I go down this road any further I wanted to make sure that I'm not barking up the wrong tree here.
Is it at all possible to configure beans with specific <property> elements, without providing setter methods for all the properties?