Inject dependency into a taglib class?
java, spring, taglib
Solution
Should you decide to access a Service or DAO from a custom tag then you need to access the ApplicationContext from the tag and then get the Bean.
ApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(pageContext.getServletContext());
MyService myService = applicationContext.getBean(MyService.class);
myService.doSomething();
Problem
I'm using Spring 3 and want to inject some dependencies into a class that is part of a taglib. I can imagine some kludge using constructor-arg, but I'm hoping someone else has a better idea.