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


Reply via email to