Open Daohuai0913 opened 1 year ago
老哥 为啥访问其他目录是未登录 但是访问/user/login这种放行的报错405 我下载了你的代码后就只改了数据库名和账号密码 其他没有用 是不是要写一个test 让mybatis-plus自动生成一次?
你用的V1还是V2,SpringBoot里面的报错信息看看!
C:\Users\wjz.jdks\corretto-1.8.0_362\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-Dmanagement.endpoints.jmx.exposure.include=*" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2023.1\lib\idea_rt.jar=51980:C:\Program Files\JetBrains\IntelliJ IDEA 2023.1\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\charsets.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\access-bridge-64.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\cldrdata.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\dnsns.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\jaccess.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\jfxrt.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\localedata.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\nashorn.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\sunec.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\sunjce_provider.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\sunmscapi.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\sunpkcs11.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\ext\zipfs.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\jce.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\jfr.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\jfxswt.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\jsse.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\management-agent.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\resources.jar;C:\Users\wjz.jdks\corretto-1.8.0_362\jre\lib\rt.jar;C:\Users\wjz\Downloads\Takeout-food-master\V1\target\classes;C:\Users\wjz.m2\repository\org\springframework\boot\spring-boot-starter\2.3.7.RELEASE\spring-boot-starter-2.3.7.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\boot\spring-boot\2.3.7.RELEASE\spring-boot-2.3.7.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\spring-context\5.2.12.RELEASE\spring-context-5.2.12.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\boot\spring-boot-autoconfigure\2.3.7.RELEASE\spring-boot-autoconfigure-2.3.7.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.3.7.RELEASE\spring-boot-starter-logging-2.3.7.RELEASE.jar;C:\Users\wjz.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\wjz.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\wjz.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.13.3\log4j-to-slf4j-2.13.3.jar;C:\Users\wjz.m2\repository\org\apache\logging\log4j\log4j-api\2.13.3\log4j-api-2.13.3.jar;C:\Users\wjz.m2\repository\org\slf4j\jul-to-slf4j\1.7.30\jul-to-slf4j-1.7.30.jar;C:\Users\wjz.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\wjz.m2\repository\org\springframework\spring-core\5.2.12.RELEASE\spring-core-5.2.12.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\spring-jcl\5.2.12.RELEASE\spring-jcl-5.2.12.RELEASE.jar;C:\Users\wjz.m2\repository\org\yaml\snakeyaml\1.26\snakeyaml-1.26.jar;C:\Users\wjz.m2\repository\jakarta\xml\bind\jakarta.xml.bind-api\2.3.3\jakarta.xml.bind-api-2.3.3.jar;C:\Users\wjz.m2\repository\jakarta\activation\jakarta.activation-api\1.2.2\jakarta.activation-api-1.2.2.jar;C:\Users\wjz.m2\repository\com\baomidou\mybatis-plus-boot-starter\3.5.2\mybatis-plus-boot-starter-3.5.2.jar;C:\Users\wjz.m2\repository\com\baomidou\mybatis-plus\3.5.2\mybatis-plus-3.5.2.jar;C:\Users\wjz.m2\repository\com\baomidou\mybatis-plus-extension\3.5.2\mybatis-plus-extension-3.5.2.jar;C:\Users\wjz.m2\repository\com\baomidou\mybatis-plus-core\3.5.2\mybatis-plus-core-3.5.2.jar;C:\Users\wjz.m2\repository\com\baomidou\mybatis-plus-annotation\3.5.2\mybatis-plus-annotation-3.5.2.jar;C:\Users\wjz.m2\repository\com\github\jsqlparser\jsqlparser\4.4\jsqlparser-4.4.jar;C:\Users\wjz.m2\repository\org\mybatis\mybatis\3.5.10\mybatis-3.5.10.jar;C:\Users\wjz.m2\repository\org\mybatis\mybatis-spring\2.0.7\mybatis-spring-2.0.7.jar;C:\Users\wjz.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk8\1.3.72\kotlin-stdlib-jdk8-1.3.72.jar;C:\Users\wjz.m2\repository\org\jetbrains\kotlin\kotlin-stdlib\1.3.72\kotlin-stdlib-1.3.72.jar;C:\Users\wjz.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-common\1.3.72\kotlin-stdlib-common-1.3.72.jar;C:\Users\wjz.m2\repository\org\jetbrains\annotations\13.0\annotations-13.0.jar;C:\Users\wjz.m2\repository\org\jetbrains\kotlin\kotlin-stdlib-jdk7\1.3.72\kotlin-stdlib-jdk7-1.3.72.jar;C:\Users\wjz.m2\repository\org\springframework\boot\spring-boot-starter-jdbc\2.3.7.RELEASE\spring-boot-starter-jdbc-2.3.7.RELEASE.jar;C:\Users\wjz.m2\repository\com\zaxxer\HikariCP\3.4.5\HikariCP-3.4.5.jar;C:\Users\wjz.m2\repository\org\springframework\spring-jdbc\5.2.12.RELEASE\spring-jdbc-5.2.12.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\spring-tx\5.2.12.RELEASE\spring-tx-5.2.12.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\boot\spring-boot-starter-web\2.3.7.RELEASE\spring-boot-starter-web-2.3.7.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\boot\spring-boot-starter-json\2.3.7.RELEASE\spring-boot-starter-json-2.3.7.RELEASE.jar;C:\Users\wjz.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.11.3\jackson-databind-2.11.3.jar;C:\Users\wjz.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.11.3\jackson-annotations-2.11.3.jar;C:\Users\wjz.m2\repository\com\fasterxml\jackson\core\jackson-core\2.11.3\jackson-core-2.11.3.jar;C:\Users\wjz.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.11.3\jackson-datatype-jdk8-2.11.3.jar;C:\Users\wjz.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.11.3\jackson-datatype-jsr310-2.11.3.jar;C:\Users\wjz.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.11.3\jackson-module-parameter-names-2.11.3.jar;C:\Users\wjz.m2\repository\org\springframework\boot\spring-boot-starter-tomcat\2.3.7.RELEASE\spring-boot-starter-tomcat-2.3.7.RELEASE.jar;C:\Users\wjz.m2\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.41\tomcat-embed-core-9.0.41.jar;C:\Users\wjz.m2\repository\org\glassfish\jakarta.el\3.0.3\jakarta.el-3.0.3.jar;C:\Users\wjz.m2\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.41\tomcat-embed-websocket-9.0.41.jar;C:\Users\wjz.m2\repository\org\springframework\spring-web\5.2.12.RELEASE\spring-web-5.2.12.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\spring-beans\5.2.12.RELEASE\spring-beans-5.2.12.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\spring-webmvc\5.2.12.RELEASE\spring-webmvc-5.2.12.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\spring-aop\5.2.12.RELEASE\spring-aop-5.2.12.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\spring-expression\5.2.12.RELEASE\spring-expression-5.2.12.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\boot\spring-boot-starter-mail\2.3.7.RELEASE\spring-boot-starter-mail-2.3.7.RELEASE.jar;C:\Users\wjz.m2\repository\org\springframework\spring-context-support\5.2.12.RELEASE\spring-context-support-5.2.12.RELEASE.jar;C:\Users\wjz.m2\repository\com\sun\mail\jakarta.mail\1.6.5\jakarta.mail-1.6.5.jar;C:\Users\wjz.m2\repository\com\sun\activation\jakarta.activation\1.2.2\jakarta.activation-1.2.2.jar;C:\Users\wjz.m2\repository\org\projectlombok\lombok\1.18.24\lombok-1.18.24.jar;C:\Users\wjz.m2\repository\com\alibaba\fastjson\2.0.20\fastjson-2.0.20.jar;C:\Users\wjz.m2\repository\com\alibaba\fastjson2\fastjson2-extension\2.0.20\fastjson2-extension-2.0.20.jar;C:\Users\wjz.m2\repository\com\alibaba\fastjson2\fastjson2\2.0.20\fastjson2-2.0.20.jar;C:\Users\wjz.m2\repository\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\wjz.m2\repository\mysql\mysql-connector-java\8.0.22\mysql-connector-java-8.0.22.jar;C:\Users\wjz.m2\repository\com\alibaba\druid-spring-boot-starter\1.2.15\druid-spring-boot-starter-1.2.15.jar;C:\Users\wjz.m2\repository\com\alibaba\druid\1.2.15\druid-1.2.15.jar;C:\Users\wjz.m2\repository\org\slf4j\slf4j-api\1.7.30\slf4j-api-1.7.30.jar;C:\Users\wjz.m2\repository\com\aliyun\aliyun-java-sdk-core\4.6.3\aliyun-java-sdk-core-4.6.3.jar;C:\Users\wjz.m2\repository\com\google\code\gson\gson\2.8.6\gson-2.8.6.jar;C:\Users\wjz.m2\repository\org\apache\httpcomponents\httpclient\4.5.13\httpclient-4.5.13.jar;C:\Users\wjz.m2\repository\commons-codec\commons-codec\1.14\commons-codec-1.14.jar;C:\Users\wjz.m2\repository\org\apache\httpcomponents\httpcore\4.4.14\httpcore-4.4.14.jar;C:\Users\wjz.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\wjz.m2\repository\org\apache\commons\commons-lang3\3.10\commons-lang3-3.10.jar;C:\Users\wjz.m2\repository\javax\xml\bind\jaxb-api\2.3.1\jaxb-api-2.3.1.jar;C:\Users\wjz.m2\repository\javax\activation\javax.activation-api\1.2.0\javax.activation-api-1.2.0.jar;C:\Users\wjz.m2\repository\org\glassfish\jaxb\jaxb-runtime\2.3.3\jaxb-runtime-2.3.3.jar;C:\Users\wjz.m2\repository\org\glassfish\jaxb\txw2\2.3.3\txw2-2.3.3.jar;C:\Users\wjz.m2\repository\com\sun\istack\istack-commons-runtime\3.0.11\istack-commons-runtime-3.0.11.jar;C:\Users\wjz.m2\repository\org\bouncycastle\bcprov-jdk15on\1.70\bcprov-jdk15on-1.70.jar;C:\Users\wjz.m2\repository\org\jacoco\org.jacoco.agent\0.8.8\org.jacoco.agent-0.8.8-runtime.jar;C:\Users\wjz.m2\repository\org\ini4j\ini4j\0.5.4\ini4j-0.5.4.jar;C:\Users\wjz.m2\repository\io\opentracing\opentracing-api\0.33.0\opentracing-api-0.33.0.jar;C:\Users\wjz.m2\repository\io\opentracing\opentracing-util\0.33.0\opentracing-util-0.33.0.jar;C:\Users\wjz.m2\repository\io\opentracing\opentracing-noop\0.33.0\opentracing-noop-0.33.0.jar;C:\Users\wjz.m2\repository\com\aliyun\aliyun-java-sdk-dysmsapi\2.2.1\aliyun-java-sdk-dysmsapi-2.2.1.jar com.codermast.takeoutfood.V1Application
. _ _ /\ / '_ () \ \ \ \ ( ( )\ | ' | '| | ' \/ ` | \ \ \ \ \/ _)| |)| | | | | || (| | ) ) ) ) ' |__| .|| ||| |\, | / / / / =========|_|==============|__/=//// :: Spring Boot :: (v2.3.7.RELEASE)
2023-04-14 23:35:36.678 INFO 12744 --- [ main] com.codermast.takeoutfood.V1Application : Starting V1Application on DESKTOP-H4JBM9U with PID 12744 (C:\Users\wjz\Downloads\Takeout-food-master\V1\target\classes started by wjz in C:\Users\wjz\Downloads\Takeout-food-master\V1)
2023-04-14 23:35:36.680 INFO 12744 --- [ main] com.codermast.takeoutfood.V1Application : No active profile set, falling back to default profiles: default
2023-04-14 23:35:36.717 WARN 12744 --- [kground-preinit] o.s.h.c.j.Jackson2ObjectMapperBuilder : For Jackson Kotlin classes support please add "com.fasterxml.jackson.module:jackson-module-kotlin" to the classpath
2023-04-14 23:35:37.360 INFO 12744 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2023-04-14 23:35:37.365 INFO 12744 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-04-14 23:35:37.365 INFO 12744 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41]
2023-04-14 23:35:37.413 INFO 12744 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-04-14 23:35:37.413 INFO 12744 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 704 ms
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.
2023-04-14 23:35:37.498 INFO 12744 --- [ main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2023-04-14 23:35:37.557 INFO 12744 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited
Registered plugin: 'com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor@5c92166b'
Property 'mapperLocations' was not specified.
| |. __ |
| | |\/|)(| | |\ |)|||_\
/ |
3.5.2
2023-04-14 23:35:37.997 INFO 12744 --- [ main] c.c.takeoutfood.config.WebMvcConfig : 使用自定义消息转换器
2023-04-14 23:35:37.999 INFO 12744 --- [ main] c.c.takeoutfood.config.WebMvcConfig : 静态资源开始映射...
2023-04-14 23:35:38.132 INFO 12744 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2023-04-14 23:35:38.137 INFO 12744 --- [ main] com.codermast.takeoutfood.V1Application : Started V1Application in 1.703 seconds (JVM running for 2.125)
2023-04-14 23:35:38.138 INFO 12744 --- [ main] com.codermast.takeoutfood.V1Application : 项目启动成功:V1版本
2023-04-14 23:36:39.058 INFO 12744 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-04-14 23:36:39.058 INFO 12744 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2023-04-14 23:36:39.062 INFO 12744 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 4 ms
2023-04-14 23:36:39.066 INFO 12744 --- [nio-8080-exec-1] c.c.takeoutfood.filter.LoginCheckFilter : 用户登录过滤器成功拦截到请求:/
2023-04-14 23:36:39.068 INFO 12744 --- [nio-8080-exec-1] c.c.takeoutfood.filter.LoginCheckFilter : 未登录,已拦截....
2023-04-14 23:36:39.248 INFO 12744 --- [nio-8080-exec-3] c.c.takeoutfood.filter.LoginCheckFilter : 用户登录过滤器成功拦截到请求:/favicon.ico
2023-04-14 23:36:39.248 INFO 12744 --- [nio-8080-exec-3] c.c.takeoutfood.filter.LoginCheckFilter : 未登录,已拦截....
2023-04-14 23:36:44.678 INFO 12744 --- [nio-8080-exec-6] c.c.takeoutfood.filter.LoginCheckFilter : 用户登录过滤器成功拦截到请求:/user/login
2023-04-14 23:36:44.679 INFO 12744 --- [nio-8080-exec-6] c.c.takeoutfood.filter.LoginCheckFilter : 匹配成功,已放行....
2023-04-14 23:36:44.695 WARN 12744 --- [nio-8080-exec-6] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported]
2023-04-14 23:36:44.978 INFO 12744 --- [nio-8080-exec-7] c.c.takeoutfood.filter.LoginCheckFilter : 用户登录过滤器成功拦截到请求:/favicon.ico
2023-04-14 23:36:44.978 INFO 12744 --- [nio-8080-exec-7] c.c.takeoutfood.filter.LoginCheckFilter : 未登录,已拦截....
没有报错 但是前端就是 405
这是因为请求方式不被允许,你看controller包里面UserController类中的login方法并不是get请求,所以报错信息是方法类型不被允许
这个项目的前台和后台地址我一会更新在项目介绍里,是直接通过html页面访问的,我先给你说一下
前台:/front/index.html 后台:/backend/index.html
不用访问login请求,这个是通过页面发post请求来登陆的
改成get后直接报400了
/backend/index.html
好的 好像可以访问了
/backend/index.html
好的 好像可以访问了
usercontroller中的方法是不需要更改的,是你访问的页面错误了,你访问我提供的那两个地址,就能看到页面了,你直接访问api接口会报错的,或者你使用api调试工具模拟发请求调试也可以的,有什么问题欢迎关注我的微信公众号,我会在线回复的
老哥 为啥访问其他目录是未登录 但是访问/user/login这种放行的报错405 我下载了你的代码后就只改了数据库名和账号密码 其他没有用 是不是要写一个test 让mybatis-plus自动生成一次?