mirror of https://github.com/halo-dev/halo
Refactor WebMvcAutoConfiguration
parent
f0651f8c37
commit
d81837e3c9
|
@ -83,6 +83,8 @@ public class WebMvcAutoConfiguration implements WebMvcConfigurer {
|
||||||
.addResourceLocations("classpath:/static/halo-admin/images/favicon.ico");
|
.addResourceLocations("classpath:/static/halo-admin/images/favicon.ico");
|
||||||
registry.addResourceHandler("/backup/**")
|
registry.addResourceHandler("/backup/**")
|
||||||
.addResourceLocations("file:///" + System.getProperties().getProperty("user.home") + "/halo/backup/");
|
.addResourceLocations("file:///" + System.getProperties().getProperty("user.home") + "/halo/backup/");
|
||||||
|
registry.addResourceHandler("/admin/**")
|
||||||
|
.addResourceLocations("classpath:/static/admin/");
|
||||||
|
|
||||||
if (!haloProperties.getDocDisabled()) {
|
if (!haloProperties.getDocDisabled()) {
|
||||||
// If doc is enable
|
// If doc is enable
|
||||||
|
@ -93,30 +95,6 @@ public class WebMvcAutoConfiguration implements WebMvcConfigurer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 国际化设置
|
|
||||||
*
|
|
||||||
* @return LocaleResolver
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public LocaleResolver localeResolver() {
|
|
||||||
final SessionLocaleResolver slr = new SessionLocaleResolver();
|
|
||||||
slr.setDefaultLocale(Locale.CHINA);
|
|
||||||
return slr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 国际化参数拦截器
|
|
||||||
*
|
|
||||||
* @return LocaleChangeInterceptor
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public LocaleChangeInterceptor localeChangeInterceptor() {
|
|
||||||
final LocaleChangeInterceptor lci = new LocaleChangeInterceptor();
|
|
||||||
lci.setParamName("lang");
|
|
||||||
return lci;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addFormatters(FormatterRegistry registry) {
|
public void addFormatters(FormatterRegistry registry) {
|
||||||
registry.addConverterFactory(new StringToEnumConverterFactory());
|
registry.addConverterFactory(new StringToEnumConverterFactory());
|
||||||
|
|
Loading…
Reference in New Issue