Springboot Custom Favicon.ico (including source code)

Source: Internet
Author: User
the default Favicon


Spring Boot provides a default favicon that can be seen every time the app is accessed.

SpringBoot自定义favicon.ico(含源码)




We can set the off Favicon in Application.properties, which is on by default.


Spring.mvc.favicon.enable=false 


or set the close favicon in application.yml


Spring:
  MVC:
    favicon:
      enabled:false
Set your own Favicon


If you need to set your own favicon, simply place your own Favicon.ico file at the Classpath root, under the Classpath meta-inf/resources/, under the Classpath resources/, under the Classpath static/, or under the Classpath public/.



This places the Favicon.ico under Src/main/resources/static.

SpringBoot自定义favicon.ico(含源码)


Source Analysis



Application.properties


Spring.mvc.favicon.enabled=false


Indexcontroller. java


@Controller public
class Indexcontroller {

    @RequestMapping (value = '/index ') public
    String Index (Model Model) {
        Model.addattribute ("name", "Springbootfavicon");
        Return "index";
    }
}


Indexrestcontroller. java


@RestController public
class Indexrestcontroller {

    @RequestMapping (value = '/indexrest ') public
    String Index () {
        return "indexrest";
    }
}


Runapplication. java


@SpringBootApplication public
class Runapplication {public

    static void Main (string[] args) {
        Springapplication.run (Runapplication.class, args);
    }
}


Run the Runapplication,java effect diagram



Accessing REST Requests



SpringBoot自定义favicon.ico(含源码)



Visit page


SpringBoot自定义favicon.ico(含源码)




Access Error Request

SpringBoot自定义favicon.ico(含源码)
Source Download



Springboot Custom Favicon.ico (including source code)



Springboot Introduction + Combat series Source)



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. Reprint Please specify source: Http://blog.csdn.net/wenteryan


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.