Make AbstractTemplateEngine#init method final, use lazy instantiation#591
Make AbstractTemplateEngine#init method final, use lazy instantiation#591
Conversation
|
@decebals , I took a look over and it looks ok. Tomorrow I will test it with my application that uses Freemarker. Then I come back here. |
|
@decebals , please see this comment: d0793e2#r61118560-permalink |
My idea is to bring each component where is used. Now many components extract dependencies from I recognize that now is a little bit verbose to set a custom Please feel free to say what you think, because your feedback is important to me. |
|
Remove |
|
I did as in the test class above and in my application I got the error stack below: Error: So I needed to set the public class PippoApplication extends ControllerApplication {
@Override
protected void onInit() {
ControllerFactory controllerFactory = new GuiceControllerFactory(injector);
ControllerHandlerFactory controllerHandlerFactory = new DefaultControllerHandlerFactory()
.setControllerFactory(controllerFactory)
.setContentTypeEngines(getContentTypeEngines()) // <<< I had to define here
;
ControllerRouteFactory controllerRouteFactory = new DefaultControllerRouteFactory()
.setControllerHandlerFactory(controllerHandlerFactory)
;
setControllerRouteFactory(controllerRouteFactory);
}
}If I don't set the engines in the |
oops, I'll check this change... |
|
@decebals , the observation I made above #591 (comment) is still valid. It was necessary to set: ControllerFactory controllerFactory = new GuiceControllerFactory(injector);
ControllerRouteFactory controllerRouteFactory = new DefaultControllerRouteFactory()
.setControllerFactory(controllerFactory)
.setContentTypeEngines(getContentTypeEngines()) // <<< I had to define here - getting from Application
;
setControllerRouteFactory(controllerRouteFactory); |
Yes. We will see in the future if we can improve this. |
|
From what I see, we don't need By the way, the new release will be |
|
Well... these changes worked in my application with the modifications I mentioned earlier. I will then approve this PR. |
I don't understand. Is it works and I can merge it or do you need more time for a test? |
The goal of this PR is to facilitate #590.
I think that now the code looks better and the performance is a little better (using lazy instantiation).