-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dependency Injection for serializers #237
Comments
Relevent discussion: https://groups.google.com/forum/#!topic/taffy-users/CVBV0ASO6kM I took some time to look at this yesterday evening and thought I had made some progress but although the dependency injection itself seemed to work, I started getting strange issues with things not being returned from the endpoint correctly - so strange that it must be something about my particular codebase. What I did find: In newRepresentation() https://github.com/atuttle/Taffy/blob/develop/core/api.cfc#L929 you are using the loaded beanFactory to create the serializer. If you are using an external beanFactory, and you have your custom serializer loaded into the bean factory, and you provide just the name of the customSerializer, not the path to framework.serializer - everything should work at that point. Again, in mine I was getting strange issues, but they were so strange I can't believe it is a taffy issue, but I didnt have enough time to research it further. Now, if you are not using an external bean factory, I don't believe the internal bean factory is loading anything but the resources directory: https://github.com/atuttle/Taffy/blob/develop/core/api.cfc#L320 |
So I started researching this again this morning and found the issue I was having, you need to ensure that your beanFactory is treating the serializer as transient, or it will cache withStatus() inputs from previous calls. |
Excellent point: Serializers should definitely be treated as transients. I do that with Taffy's built-in factory but we should document it for anyone using an external bean factory. I have some changes in progress in the built-in factory to resolve dependencies of serializers as they're requested, but I still have 1 failing unit test that I need to resolve. |
Also fixes a bug with property-based DI in beans
Leaving this open for now as a reminder to update the docs as discussed. |
Looking at the code, it doesn't look like Taffy does dependency injection on serializers currently. 3.0.0 C2
The text was updated successfully, but these errors were encountered: