title: how to tell spring to load resources from custom directory with maven multi-module springboot
body: <p>I tried to build a maven multi-module web project:</p>
  
  <p><code>project A, project B, ...</code></p>
  
  <p><strong>B</strong> dependent on <strong>A</strong></p>
  
  <p>run project <strong>B</strong>, the console shown than <code>/hello</code> were mapped, but <code>hello.jsp</code> not found when check <code>localhost:8080/hello</code></p>
  
  <p>here are my questions:</p>
  
  <ol>
  <li><p>how did i use hello.jsp（resources in <strong>A</strong>）while running project B?</p></li>
  <li><p>how to tell spring load resources from directory <code>src/main/resources/</code>?</p></li>
  </ol>
  
  <p><strong>structure A/B</strong></p>
  
  <pre><code>A/B
  |_src
  |  |_main
  |  |   |_java
  |  |   |  |_com.x
  |  |   |  |  |_AStarter.java/BStarter.java 
  |  |   |  |_com.x.domain
  |  |   |  |_com.x.services
  |  |   |  |_com.x.web
  |  |   |     |_HelloController.java/FooController.java
  |  |   |_resources
  |  |      |_application.properties
  |  |      |_templates
  |  |         |_hello.jsp
  |  |_test
  |      |_java
  |      |_resources
  |_pom.xml  
  </code></pre>
  
  <p>(A)pom.xml were a simple spring-boot like file.
  (B)pom.xml similar to (A)pom.xml just add a dependency:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;X&lt;/groupId&gt;
      &lt;artifactId&gt;A&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>application.properties:
      spring.view.suffix: .jsp</p>
  
  <hr>
  
  <p><strong>update</strong>  </p>
  
  <p>Starters:</p>
  
  <pre><code>@Configuration
  @EnableAutoConfiguration
  @ComponentScan
  public class AStarter extends SpringBootServletInitializer {
      @Override
      protected SpringApplicationBuilder configure(
              SpringApplicationBuilder application) {
          return application.sources(AStarter.class);
       }
      public static void run(Class&lt;? extends AStarter&gt; c, String[] args) {
          SpringApplication.run(c, args);
      }
      public static void main(String[] args) throws Exception {
          run(AStarter.class, args);
      }
  }
  
  @Configuration
  @EnableAutoConfiguration
  @ComponentScan
  public class BStarter extends AStarter {
      public static void main(String[] args) {
          AStarter.run(BStarter.class, args);
      }
  }
  </code></pre>
  
  <p>Controllers:</p>
  
  <pre><code>@Controller
  public class HelloController {
      private String message = "Hello World";
      @RequestMapping("/hello")
      public String welcome(Map&lt;String, Object&gt; model) {
          model.put("time", new Date());
          model.put("message", this.message);
          return "hello";
      }
  }
  
  @Controller
  public class FooController {
      @RequestMapping("/foo")
      public String foo(Map&lt;String, Object&gt; model) {
          model.put("foo", "foo!");
          return "foo";
      }
  }
  </code></pre>
  
  <p>console:</p>
  
  <pre><code>--- {main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/foo],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.x.FooController.foo(java.util.Map&lt;java.lang.String, java.lang.Object&gt;)
  --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/hello],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.x.web.HelloController.welcome(java.util.Map&lt;java.lang.String, java.lang.Object&gt;)
  --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity&lt;java.util.Map&lt;java.lang.String, java.lang.Object&gt;&gt; org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
  --- [main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
  </code></pre>
  
  <p><strong>when i check localhoust:8080/hello, error came out</strong>
  <img src="https://i.stack.imgur.com/BfDZf.png" alt="enter image description here"></p>
  
  <p>Thanks in advance！</p>