Because in the Springboot 2.0 Webmvcautoconfigurationadapter this class becomes an automatic configuration class if you want to integrate many of the properties of this class autoconfiguration will fail, which means that the class has expired you need to use
Interface to implement local mapping of static resources and a series of functions such as front-end cross-domain
@Configuration Public classWebappconfigImplementsWebmvcconfigurer {/** Static Resource Local mapping * IMG is virtual path * mapped to local D-Disk javaspace under Tomcatpath * Browser access: localhost:8080/img/xxx file **/ Public voidaddresourcehandlers (Resourcehandlerregistry registry) {Registry.addresourcehandler ("/img/**"). Addresourcelocations ("file:d:/javaspace/tomcatpath/"). Setcacheperiod (31556926); } //front-end cross-domain Public voidaddcorsmappings (Corsregistry registry) {registry.addmapping ("/**")//set the path allowed across domains. Allowedorigins ("*")//set up domain names that allow cross-domain requests. Allowcredentials (true)//whether to allow certificates to no longer be turned on by default. Allowedmethods ("GET", "POST", "PUT", "DELETE")//to set allowed methods. MaxAge (3600);//allow time across domains }}
Springboot 2.0 front-end cross-domain static resource local mapping