1.
I am working with Spring Boot. My main class is very simple
@ComponentScan
@EnableAutoConfiguration
@Configuration
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
# 2. Now I would like to make my static content external to the jar file. So below is the jar project
/pom.xml
/src/main/resources/META-INF/resources/hello.json // here is my resource
I make maven installand put the dependency in the main application, usually run the application. Now I can call http://localhost:8080/hello.jsonto get the hello.json file
# 3. Then the next step uses Apache Tiles for my main web project, so I create a class @EnableWebMvcfor customizationtilesViewResolver
@Configuration
@EnableWebMvc
public class WebMvcConfiguration extends WebMvcConfigurerAdapter {
public @Bean TilesViewResolver tilesViewResolver() {
return new TilesViewResolver();
}
public @Bean TilesConfigurer tilesConfigurer() {
TilesConfigurer ret = new TilesConfigurer();
ret.setDefinitions(new String[] { "classpath:tiles.xml" });
return ret;
}
}
Then I ran the application again and tried hello.jsonto make everything work properly. But a 404 page appears. Remove WebMvcConfigurationreturn mine hello.json.
What configuration should I do to solve this problem?
.