hb0730 / boot-admin

BOOT-ADMIN是一个基于Spring Boot3和Vue3 的开源项目,项目采用前后端分离的模式,前端框架使用vue-pure-admin
MIT License
260 stars 87 forks source link

项目启动之后,该访问的url是什么? #3

Closed keith-ch closed 3 years ago

keith-ch commented 3 years ago

访问 http://localhost:8088/ 显示: {"message":"访问未授权","code":"A0301","data":"请求访问:/ ,认证失败,无法访问系统资源"} 访问地址不对,还是需要修改哪个配置吗?

后台报错日志: org.springframework.security.authentication.InsufficientAuthenticationException: Full authentication is required to access this resource at org.springframework.security.web.access.ExceptionTranslationFilter.handleSpringSecurityException(ExceptionTranslationFilter.java:189) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:140) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)

hb0730 commented 3 years ago

image

hb0730 commented 3 years ago

image

keith-ch commented 3 years ago

大佬,没看明白, 是要修改这两个代码吗 访问什么地址,能进入系统页面?

keith-ch commented 3 years ago

访问http://localhost:8088/auth/login 显示: Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Sep 22 11:30:50 CST 2021 There was an unexpected error (type=Method Not Allowed, status=405). Request method 'GET' not supported org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleNoMatch(RequestMappingInfoHandlerMapping.java:213) at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lookupHandlerMethod(AbstractHandlerMethodMapping.java:422)

后台日志: 2021-09-22 11:31:27.693 WARN 18500 --- [nio-8088-exec-6] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported]

hb0730 commented 3 years ago

这个项目是前后分离的项目,前端项目https://github.com/hb0730/boot-admin-ui ,并不需要修改任何信息

keith-ch commented 3 years ago

这个项目是前后分离的项目,前端项目https://github.com/hb0730/boot-admin-ui ,并不需要修改任何信息

这俩项目如何整合呢?或者说我怎么给boot-admin增加前端页面

hb0730 commented 3 years ago

具体的可以看一看springboot与template模板引擎的配置,一般放置resources的template或者static等目录,然后开放对应的path即可

keith-ch commented 3 years ago

具体的可以看一看springboot与template模板引擎的配置,一般放置resources的template或者static等目录,然后开放对应的path即可

谢谢大佬!

keith-ch commented 3 years ago

@hb0730 大佬,我把boot-admin和boot-admin-ui整合了,然后修改vue.config.js指定后端url: 代码如下:

module.exports = { // 根据你的实际情况更改这里 publicPath, lintOnSave: true, devServer: { publicPath, // 和 publicPath 保持一致 disableHostCheck: process.env.NODE_ENV === 'development', // 关闭 host check,方便使用 ngrok 之类的内网转发工具, proxy: { '/': { target: 'http://localhost:8088', //目标接口域名 secure: false, //false为http访问,true为https访问 changeOrigin: true, //是否跨域 pathRewrite: { '^/': '/' //重写接口 } } } }, 登录可以,但是进去之后点页面都提示 page not found,这是为什么呢?

hb0730 commented 3 years ago

https://d2.pub/zh/doc/d2-admin/webpack/#vue-config-js

hb0730 commented 3 years ago

其实可以开放的时候分离,部署的时候在一起

hb0730 commented 3 years ago

不过我自己没有尝试过在一起的