Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Configuration
- public class FaviconConfiguration {
- @Bean
- public SimpleUrlHandlerMapping faviconHandlerMapping() {
- SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
- mapping.setOrder(Integer.MIN_VALUE);
- mapping.setUrlMap(Collections.singletonMap("**/favicon.ico", faviconRequestHandler()));
- return mapping;
- }
- @Bean
- protected ResourceHttpRequestHandler faviconRequestHandler() {
- ResourceHttpRequestHandler requestHandler = new ResourceHttpRequestHandler();
- ClassPathResource classPathResource = new ClassPathResource("static/");
- List<Resource> locations = Arrays.asList(classPathResource);
- requestHandler.setLocations(locations);
- return requestHandler;
- }
- }
- spring.mvc.favicon.enabled=true # Enable resolution of favicon.ico.
- @Configuration
- public static class FaviconConfiguration {
- @Bean
- public SimpleUrlHandlerMapping faviconHandlerMapping() {
- SimpleUrlHandlerMapping mapping = new SimpleUrlHandlerMapping();
- mapping.setOrder(Integer.MIN_VALUE);
- mapping.setUrlMap(Collections.singletonMap("mylocation/favicon.ico",
- faviconRequestHandler()));
- return mapping;
- }
- }
Add Comment
Please, Sign In to add comment