diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java index 9bf362b95ba..8a7086632f1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.java @@ -16,12 +16,15 @@ package org.springframework.boot.autoconfigure.web; +import java.io.IOException; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import javax.servlet.Servlet; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -99,6 +102,8 @@ public class WebMvcAutoConfiguration { @EnableWebMvc public static class WebMvcAutoConfigurationAdapter extends WebMvcConfigurerAdapter { + private static Log logger = LogFactory.getLog(WebMvcConfigurerAdapter.class); + @Autowired private ListableBeanFactory beanFactory; @@ -162,6 +167,12 @@ public class WebMvcAutoConfiguration { private void addStaticIndexHtmlViewControllers(ViewControllerRegistry registry) { for (String resource : STATIC_INDEX_HTML_RESOURCES) { if (this.resourceLoader.getResource(resource).exists()) { + try { + logger.info("Adding welcome page: " + + this.resourceLoader.getResource(resource).getURL()); + } + catch (IOException e) { + } registry.addViewController("/").setViewName("/index.html"); return; } diff --git a/spring-boot-cli/src/main/executablecontent/bin/spring b/spring-boot-cli/src/main/executablecontent/bin/spring index 66c52be8831..6aa158b6e15 100755 --- a/spring-boot-cli/src/main/executablecontent/bin/spring +++ b/spring-boot-cli/src/main/executablecontent/bin/spring @@ -79,7 +79,13 @@ if [ ! -d "${SPRING_HOME}" ]; then exit 2 fi -CLASSPATH="${SPRING_HOME}/lib/*" +CLASSPATH=.:${SPRING_HOME}/bin +if [ -d ${SPRING_HOME}/ext ]; then + CLASSPATH=$CLASSPATH:${SPRING_HOME}/ext +fi +for f in ${SPRING_HOME}/lib/*; do + CLASSPATH=$CLASSPATH:$f +done if $cygwin; then SPRING_HOME=`cygpath --path --mixed "$SPRING_HOME"` diff --git a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java index 98626627279..f74a9535b30 100644 --- a/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java +++ b/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMvcCompilerAutoConfiguration.java @@ -16,6 +16,12 @@ package org.springframework.boot.cli.compiler.autoconfigure; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.control.customizers.ImportCustomizer; import org.springframework.boot.cli.compiler.AstUtils; @@ -47,7 +53,8 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio @Override public boolean matches(ClassNode classNode) { - return AstUtils.hasAtLeastOneAnnotation(classNode, "Controller", "EnableWebMvc"); + return AstUtils.hasAtLeastOneAnnotation(classNode, "Controller", "EnableWebMvc", + "WebConfiguration"); } @Override @@ -58,6 +65,13 @@ public class SpringMvcCompilerAutoConfiguration extends CompilerAutoConfiguratio "org.springframework.web.servlet.handler", "org.springframework.http"); imports.addStaticImport("org.springframework.boot.cli.template.GroovyTemplate", "template"); + imports.addImports(WebConfiguration.class.getCanonicalName()); + } + + @Target(ElementType.TYPE) + @Retention(RetentionPolicy.SOURCE) + @Documented + public static @interface WebConfiguration { } }