2018-04-23 00:00:29 +08:00
|
|
|
|
package com.ruoyi.framework.config;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
|
|
import org.springframework.core.Ordered;
|
2018-05-13 15:10:15 +08:00
|
|
|
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
2018-04-23 00:00:29 +08:00
|
|
|
|
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
|
|
|
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 通用配置
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author ruoyi
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Configuration
|
2018-05-13 15:10:15 +08:00
|
|
|
|
public class ResourcesConfig extends WebMvcConfigurerAdapter
|
2018-04-23 00:00:29 +08:00
|
|
|
|
{
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 首页地址
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Value("${shiro.user.indexUrl}")
|
|
|
|
|
|
private String indexUrl;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 默认首页的设置,当输入域名是可以自动跳转到默认指定的网页
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void addViewControllers(ViewControllerRegistry registry)
|
|
|
|
|
|
{
|
|
|
|
|
|
registry.addViewController("/").setViewName("forward:" + indexUrl);
|
|
|
|
|
|
registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
|
|
|
|
|
super.addViewControllers(registry);
|
|
|
|
|
|
}
|
2018-05-13 15:10:15 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry)
|
|
|
|
|
|
{
|
|
|
|
|
|
registry.addResourceHandler("/profile/**").addResourceLocations("file:" + RuoYiConfig.getProfile());
|
2018-05-29 22:53:20 +08:00
|
|
|
|
|
2018-05-31 11:46:53 +08:00
|
|
|
|
/** swagger配置 */
|
2018-05-29 22:53:20 +08:00
|
|
|
|
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
|
|
|
|
|
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
2018-05-13 15:10:15 +08:00
|
|
|
|
}
|
2018-04-23 00:00:29 +08:00
|
|
|
|
}
|