diff --git a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationConfiguration.java b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationConfiguration.java index 13753551f7c..2e169e62266 100644 --- a/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationConfiguration.java +++ b/jetty-annotations/src/test/java/org/eclipse/jetty/annotations/TestAnnotationConfiguration.java @@ -118,25 +118,25 @@ public class TestAnnotationConfiguration @Test public void testAnnotationScanControl() throws Exception { - //check that a 2.5 webapp won't discover annotations + //check that a 2.5 webapp with configurationDiscovered will discover annotations TestableAnnotationConfiguration config25 = new TestableAnnotationConfiguration(); WebAppContext context25 = new WebAppContext(); context25.setClassLoader(Thread.currentThread().getContextClassLoader()); context25.setAttribute(AnnotationConfiguration.MULTI_THREADED, Boolean.FALSE); context25.setAttribute(AnnotationConfiguration.MAX_SCAN_WAIT, 0); + context25.setConfigurationDiscovered(false); context25.getMetaData().setWebDescriptor(new WebDescriptor(Resource.newResource(web25))); context25.getServletContext().setEffectiveMajorVersion(2); context25.getServletContext().setEffectiveMinorVersion(5); config25.configure(context25); config25.assertAnnotationDiscovery(false); - //check that a 2.5 webapp with configurationDiscovered will discover annotations + //check that a 2.5 webapp discover annotations TestableAnnotationConfiguration config25b = new TestableAnnotationConfiguration(); WebAppContext context25b = new WebAppContext(); context25b.setClassLoader(Thread.currentThread().getContextClassLoader()); context25b.setAttribute(AnnotationConfiguration.MULTI_THREADED, Boolean.FALSE); context25b.setAttribute(AnnotationConfiguration.MAX_SCAN_WAIT, 0); - context25b.setConfigurationDiscovered(true); context25b.getMetaData().setWebDescriptor(new WebDescriptor(Resource.newResource(web25))); context25b.getServletContext().setEffectiveMajorVersion(2); context25b.getServletContext().setEffectiveMinorVersion(5); @@ -293,6 +293,7 @@ public class TestAnnotationConfiguration AnnotationConfiguration config = new AnnotationConfiguration(); WebAppContext context = new WebAppContext(); List scis; + context.setConfigurationDiscovered(false); context.setClassLoader(webAppLoader); context.getMetaData().setWebDescriptor(new WebDescriptor(Resource.newResource(web25))); context.getMetaData().setWebInfClassesResources(classes); diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java index 5b55d08712f..284d1332247 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java @@ -209,7 +209,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL private Map _resourceAliases; private boolean _ownClassLoader = false; - private boolean _configurationDiscovered = false; + private boolean _configurationDiscovered = true; private boolean _allowDuplicateFragmentNames = false; private boolean _throwUnavailableOnStartupException = false; diff --git a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/MetaInfConfigurationTest.java b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/MetaInfConfigurationTest.java index 599872a30d6..c28aa703713 100644 --- a/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/MetaInfConfigurationTest.java +++ b/jetty-webapp/src/test/java/org/eclipse/jetty/webapp/MetaInfConfigurationTest.java @@ -84,20 +84,20 @@ public class MetaInfConfigurationTest File web31 = MavenTestingUtils.getTestResourceFile("web31.xml"); File web31false = MavenTestingUtils.getTestResourceFile("web31false.xml"); - //test a 2.5 webapp will not look for fragments by default + //test a 2.5 webapp will not look for fragments as manually configured MetaInfConfiguration meta25 = new TestableMetaInfConfiguration(MetaInfConfiguration.__allScanTypes, Arrays.asList(MetaInfConfiguration.METAINF_TLDS, MetaInfConfiguration.METAINF_RESOURCES)); WebAppContext context25 = new WebAppContext(); + context25.setConfigurationDiscovered(false); context25.getMetaData().setWebDescriptor(new WebDescriptor(Resource.newResource(web25))); context25.getServletContext().setEffectiveMajorVersion(2); context25.getServletContext().setEffectiveMinorVersion(5); meta25.preConfigure(context25); - //test a 2.5 webapp will look for fragments if configurationDiscovered==true + //test a 2.5 webapp will look for fragments as configurationDiscovered default true MetaInfConfiguration meta25b = new TestableMetaInfConfiguration(MetaInfConfiguration.__allScanTypes, MetaInfConfiguration.__allScanTypes); WebAppContext context25b = new WebAppContext(); - context25b.setConfigurationDiscovered(true); context25b.getMetaData().setWebDescriptor(new WebDescriptor(Resource.newResource(web25))); context25b.getServletContext().setEffectiveMajorVersion(2); context25b.getServletContext().setEffectiveMinorVersion(5);