java - WelcomeController can't find path to index.html -


i working on webapplication springboot mvc pattern. have 4 maven projects (dao project, rest project(there springboot class starting application), service project , client project). projects connected through dependencies.

my problem client project. there have welcomecontroller :

package com.itengine.scoretracker.client.controller;  import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.requestmapping;  @controller public class welcomecontroller {      @requestmapping("/")     public string welcome(){         return "static/html/index.html";     } } 

and html's on path:

enter image description here

when relocate static folder client project in rest project on same location, welcomecontroller see index.html , works fine.

so please, can me issue, need html's in client project. dont have experience configuration xml's because learned on course springboot without xml's.

my web.xml's empty, have this:

<!doctype web-app public "-//sun microsystems, inc.//dtd web application    2.3//en" "java.sun.com/dtd/web-app_2_3.dtd"; > <web-app> <display-name>archetype created web application</display-name> </web-app> 

my main class this:

package com.itengine.scoretracker.rest.init;  import org.springframework.boot.springapplication; import org.springframework.boot.autoconfigure.springbootapplication; import org.springframework.boot.builder.springapplicationbuilder; import org.springframework.boot.context.web.springbootservletinitializer; import org.springframework.boot.orm.jpa.entityscan; import org.springframework.context.annotation.componentscan; import org.springframework.data.jpa.repository.config.enablejparepositories;   @componentscan("com.itengine") @entityscan("com.itengine") @enablejparepositories("com.itengine.scoretracker.dao.repository") @springbootapplication public class scoretrackerapplication     extends springbootservletinitializer{      @override     protected springapplicationbuilder configure(             springapplicationbuilder builder){          return builder.sources(scoretrackerapplication.class);     }      public static void main(string[] args) {          springapplication.run(scoretrackerapplication.class, args);      } } 

thanks in advance!

move static folder src/main/resources ends deployed on classpath. mapping / can removed.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -