package my.package.webapp;
import my.package.io.MyUploader;
public class Notifier extends MultiThreadedApplicationAdapter {
private final Logger log = Red5LoggerFactory.getLogger(getClass());
private MyUploader uploader;
@Override
public boolean appStart(final IScope app) {
log.info("uploader = {}", uploader);
}
...
}
I've got a JAR file, MyJar.jar, created as part of a separate project, that includes the class my.package.io.MyUploader. The JAR contains a Spring app, and MyUploader is a singleton, annotated as a @Service.
I've added MyJar.jar to the webapp's pom.xml as a provided dependency, and the webapp compiles as I'd expect.
I copied MyJar.jar to my Red5Pro server's lib directory.
=> I want Notifier to have its uploader field set to an instance of my.package.io.MyUploader at startup using Spring dependency injection
I edited the webapp's red5-web.xml file and added various <bean .../> declarations like so:
<bean id="uploader" class="my.package.io.Uploader" autowire="byType"/>
I also tried omitting the autowire declaration, tried using byName, and more.
What I expect:
The appStart method runs.
The log shows
uploader = my.package.io.MyUploader@xxxxxx
What actually happens:
The appStart method runs.
The log shows
uploader = null
My Question:
How do I arrange it so my Notifier class gets a MyUploader instance injected into its uploader field?
I normally use Spring with annotation-based dependency management, so I may have overlooked something obvious in my XML.
Thanks,
Herb