the default Favicon
Spring Boot provides a default favicon that can be seen every time the app is accessed.
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.
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
Visit page
Access Error Request
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