I think I missed something.
To be clear what I meant by tag as jsp tag with tld defined.
Yes my resource beans are defined in Spring, using XML actually. However my
tag classes are not.
From what I understand, the life cycle of tag is controlled by the web
container therefore not defined in Spring.
However I know that Struts tags do get intervened by Struts during the life
cycle that's why using the Struts @Inject works.
But when Struts inject its own resource, does it/will it inject resource
defined in Spring?
Or did I miss something?
Thanks
On Wed, Dec 4, 2013 at 5:26 PM, Miguel Almeida mig...@almeida.at wrote:
If you @Autowire something into your class you're essentially doing the
same as retrieving the resources from ApplicationContext.
Once you define your class as a Spring bean in Spring's configuration
(either by explicitly defining it in an XML or because it's in a
classpath which you've told Spring to scan) it is managed by spring - so
you'll be able to inject whatever you want onto the bean.
Beware of the scope you give to that bean, though. If it's in a tag, you
might want to give it a request scope.
Miguel
On Wed, 2013-12-04 at 11:00 +0800, Steven Yang wrote:
Hi
I am writing some custom tags.
I want to access some resource from Spring.
Is there a clean way of doing it, instead of getting the
ApplicationContext
in the Components?
Will @Inject work for non-Struts values?
Or @Autowire will work as well?
I am using the spring plugin.
Thanks