add resources example
This commit is contained in:
parent
0d54eca2bf
commit
c8db7fb9bc
49
src/main/java/email/configuration/MvcConfiguration.java
Normal file
49
src/main/java/email/configuration/MvcConfiguration.java
Normal file
@ -0,0 +1,49 @@
|
||||
package email.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.i18n.CookieLocaleResolver;
|
||||
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
|
||||
|
||||
@Configuration
|
||||
public class MvcConfiguration implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addViewControllers(ViewControllerRegistry registry) {
|
||||
registry.addViewController("/{articlename:\\w+}");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry
|
||||
.addResourceHandler("/webjars/**")
|
||||
.addResourceLocations("/webjars/");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LocaleResolver localeResolver() {
|
||||
return new CookieLocaleResolver();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LocaleChangeInterceptor localeInterceptor() {
|
||||
LocaleChangeInterceptor localeInterceptor = new LocaleChangeInterceptor();
|
||||
localeInterceptor.setParamName("lang");
|
||||
return localeInterceptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(localeInterceptor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCorsMappings(CorsRegistry registry) {
|
||||
registry.addMapping("/**");
|
||||
}
|
||||
}
|
BIN
src/main/resources/public/img/logo.png
Normal file
BIN
src/main/resources/public/img/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
@ -89,6 +89,7 @@
|
||||
</tbody>
|
||||
</table>-->
|
||||
<a class="btn btn-primary" href="/">Отправить другое сообщение</a>
|
||||
<!-- <img src="img/logo.png"/>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user