解决swagger无法访问问题,以及swagger报404问题
This commit is contained in:
parent
869dcf73f8
commit
c601a9a052
@ -3,12 +3,14 @@ package com.ruoyi;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import springfox.documentation.oas.annotations.EnableOpenApi;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableOpenApi //开启swagger
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
|
||||
public class RuoYiApplication
|
||||
{
|
||||
|
@ -15,10 +15,10 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||
@RequestMapping("/tool/swagger")
|
||||
public class SwaggerController extends BaseController
|
||||
{
|
||||
@PreAuthorize("@ss.hasPermi('tool:swagger:view')")
|
||||
//@PreAuthorize("@ss.hasPermi('tool:swagger:view')")
|
||||
@GetMapping()
|
||||
public String index()
|
||||
{
|
||||
return redirect("/swagger-ui.html");
|
||||
return redirect("/swagger-ui/index.html");
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,9 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
url: jdbc:mysql://localhost:3306/myvue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: password
|
||||
password: 123456
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
|
@ -96,8 +96,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
||||
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
|
||||
// 过滤请求
|
||||
.authorizeRequests()
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||
.antMatchers("/login", "/register", "/captchaImage").anonymous()
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问,tool下的路径放开验证
|
||||
.antMatchers("/login", "/register", "/captchaImage","/tool/*").anonymous()
|
||||
.antMatchers(
|
||||
HttpMethod.GET,
|
||||
"/",
|
||||
@ -107,7 +107,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
||||
"/**/*.js",
|
||||
"/profile/**"
|
||||
).permitAll()
|
||||
.antMatchers("/swagger-ui.html").anonymous()
|
||||
.antMatchers("/swagger-ui/*").anonymous()
|
||||
.antMatchers("/swagger-resources/**").anonymous()
|
||||
.antMatchers("/webjars/**").anonymous()
|
||||
.antMatchers("/*/api-docs").anonymous()
|
||||
|
Loading…
x
Reference in New Issue
Block a user