2012/10/4 Davis, Chad <chad.da...@emc.com>: > So, I want to have the framework use my own custom TextProvider. Since the > framework uses DI to inject such things, I've been able to have my own custom > TextProvider injected into the system. Now, I'm encountering some other > issues related to how to correctly initialize my custom provider. > > ActionSupport#getTextProviderSupport() uses the TextProviderFactory to obtain > it's instance of a support object. Since it uses the di to inject this into > the factory, my custom version is correctly injected. However, I need to > initialize my custom support object with a resource that it needs to conduct > its business. Note, the default TextPRoviderSupport also needs a couple of > resources, and those are initialized in the factory's createInstance( Class > class, LocaleProvider provider ). So, while I've injected my own class, > there doesn't seem to be a clean way to make sure that it's initialized > properly. Should I extend the factory to handle my class and init it too? > Doesn't seem very DI-ish . . . hardcoding type specific init logic, I mean. > > Or should I create an interceptor that will inject the correct resources into > my text support object?
ActionSupport base on property injections so you cannot base on anything which is injectable - you cannot use getTextProvider during initialisation time (construction time). You can implement your own ActionSupport with constructor injected TextProvider that should solve your problem. Regards -- Ćukasz + 48 606 323 122 http://www.lenart.org.pl/ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org