Hi I've got a simple embedded Jetty server that I'd like to have load Spring via Java config. Jetty is correctly picking up the Spring Servlet initializer, but not finding my files on the classpath:
10:22:49.456 [main] INFO / - No Spring WebApplicationInitializer types detected on classpath
My config is very simple:
Server server = new Server(5050);
MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer());
server.addBean(mbContainer);
WebAppContext context = new WebAppContext();
context.setContextPath("/");
context.setWar("src/main/resources/web");
context.setConfigurations(new Configuration[] {
new WebXmlConfiguration(),
new AnnotationConfiguration()
});
server.setHandler(context);
server.start();
server.join();
I found mention of this on stackoverflow here: http://stackoverflow.com/questions/13222071/spring-3-1-webapplicationinitializer-embedded-jetty-8-annotationconfiguration
Which pointed to a fix by Jan here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=404176#c5
But I haven't had luck implementing this, and my Jetty API knowledge is pretty limited, so translating the text in Comment 5 to working code isn't happening. Effectively I just want Jetty's annotation scanner to scan the entire (or some user defined subset) of the classpath/classloader that started Jetty in the first place. Can anyone provide a minimal example of how to achieve this?
Thanks,
David