Without seeing your code, there's a few things that seem incorrect here...
- As Bernhard stated, you need to declare properties immediately inside the component block.
- Make sure in your component declaration, you include
accessors="true"
attribute.
- Make sure you reference your service based on how you have DI/1 configured. I see you you have
test.cfc
in a services
folder. I'm assuming for you to reference the property as testServices
, you set DI/1 to map it this way. Otherwise, by convention, it would be accessed as either test
or testService
. See: Basic DI/1 Conventions
- I couldn't find the source to back this up but, I am 99% certain you will not be able to access your service/DAO from
setupApplication()
. It's sort of a chicken/egg approach.
You could make this call in one of the other life cycle methods such as before()
or setupRequest()
. Depending on your use-case however, I would rethink your approach. As James mentions in his answer, this is not a common order of operations. If you need data available on every request or access to a helper method for regular processing, I could see this working for you. Outside of that, unless you were really needing this service every time, you're better off isolating its injection to only the controllers requiring it in your application. It's ultimately hard to say without knowing your intention.