我想加载我的静态资源。首先我认为它已经可以工作了,但这只是浏览器缓存的一个技巧。我只按预期加载了 html 文件,但没有得到 js、css、图像等。
======
我的开始类:
@Configuration
@Import({ ServiceConfig.class, WebMvcConfig.class })
@EnableHypermediaSupport(type = HAL)
@EnableAutoConfiguration
public class ApplicationClientMvc {
public static void main(final String[] args) {
SpringApplication.run(ApplicationClientMvc.class, args);
}
}
======
WebMvcConfig
@Configuration
@ComponentScan
public class WebMvcConfig extends WebMvcConfigurationSupport {
@Autowired public SpringTemplateEngine templateEngine;
@Bean
public ThymeleafTilesConfigurer tilesConfigurer() {
final ThymeleafTilesConfigurer configurer = new ThymeleafTilesConfigurer();
configurer.setDefinitions("classpath*:/templates/**/views.xml");
return configurer;
}
@Bean
public ThymeleafViewResolver thymeleafViewResolver() {
final ThymeleafViewResolver resolver = new ThymeleafViewResolver();
resolver.setViewClass(ThymeleafTilesView.class);
resolver.setTemplateEngine(templateEngine);
resolver.setCharacterEncoding(UTF_8);
return resolver;
}
@Bean
public TilesDialect tilesDialect() {
return new TilesDialect();
}
//
@Value("${server.session-timeout}") private Long sessionTimeOut;
@Override
public void configureAsyncSupport(final AsyncSupportConfigurer configurer) {
configurer.setDefaultTimeout(sessionTimeOut * 1000L);
configurer.registerCallableInterceptors(timeoutInterceptor());
}
@Bean
public TimeoutCallableProcessingInterceptor timeoutInterceptor() {
return new TimeoutCallableProcessingInterceptor();
}
}
======
我的项目资源
=====
访问资源
各种获取资源的方式,都不行!!!