Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Scanning for annotations using embedded Jetty

https://github.com/jetty-project/embedded-servlet-3.1/blob/master/src/test/java/org/eclipse/jetty/demo/EmbedMe.java

You need more Configuration entries btw.

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts


On Tue, Apr 1, 2014 at 10:34 AM, David Erickson <halcyon1981@xxxxxxxxx> wrote:
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




_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users



Back to the top