Guest User

Untitled

a guest
Nov 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. @Configuration
  2. public class FaviconConfiguration {
  3.  
  4. @Bean
  5. public SimpleUrlHandlerMapping faviconHandlerMapping() {
  6. SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
  7. mapping.setOrder(Integer.MIN_VALUE);
  8. mapping.setUrlMap(Collections.singletonMap("**/favicon.ico", faviconRequestHandler()));
  9. return mapping;
  10. }
  11.  
  12. @Bean
  13. protected ResourceHttpRequestHandler faviconRequestHandler() {
  14. ResourceHttpRequestHandler requestHandler = new ResourceHttpRequestHandler();
  15. ClassPathResource classPathResource = new ClassPathResource("static/");
  16. List<Resource> locations = Arrays.asList(classPathResource);
  17. requestHandler.setLocations(locations);
  18. return requestHandler;
  19. }
  20.  
  21. }
  22.  
  23. spring.mvc.favicon.enabled=true # Enable resolution of favicon.ico.
  24.  
  25. @Configuration
  26. public static class FaviconConfiguration {
  27.  
  28. @Bean
  29. public SimpleUrlHandlerMapping faviconHandlerMapping() {
  30. SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
  31. mapping.setOrder(Integer.MIN_VALUE);
  32. mapping.setUrlMap(Collections.singletonMap("mylocation/favicon.ico",
  33. faviconRequestHandler()));
  34. return mapping;
  35. }
  36. }
Add Comment
Please, Sign In to add comment