在idea开发中遇到的20个bug

新建类需要删除out目录文件,否则有bug
需要删除sevlect的target文件(写前端的时候)
java.sql.SQLSyntaxErrorException: Unknown column 'username' in 'where clause'

select * from user where username=?

java: 程序包com.fasterxml.jackson.annotation不存在

使用cmd,到项目根目录下,运行命令

mvn clean install -Dmaven.test.skip=true

mvn -U idea:idea

idea 无法加载识别本地类

删除.idea + 手动删除编译后的target文件

或者:UserService的单词少写了一个i

数据库修改表格需要刷新
href写成herf了
user-list.jsp:116 Uncaught ReferenceError: _this is not defined

在jsp文件写vue时候没有设置内部的this

Access to XMLHttpRequest at 'http://localhost:8084/user/login' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

请求的资源上不存在"Access Control Allow Origin"标头。

登录系统login界面时候无法访问

plain 复制代码
bug:
 服务器没启动:违背同源策略
 同源策略规定:一个服务想要访问另外一个服务内容,那么需要保证协议,ip地址和端口号三者相同
 跨域处理:后端跨域(注解,配置文件);前端跨域(配置代理);json

修改:

基于mapper配置跨域请求

Client does not support authentication protocol requested by server; consider upgrading MySQL client

客户端不支持服务器请求的身份验证协议;考虑升级MySQL客户端

再次检查:发现目前电脑版本mysql8,但是23年9月份做项目时候这个项目使用的是mysql5,需要更新jdbc以及其他pom文件配置

spring:

datasource:

复制代码
    url: jdbc:mysql://127.0.0.1:3306/test?characterEncoding=UTF-8&serverTimezone=UTC

    driver-class-name: com.mysql.cj.jdbc.Driver
Web server failed to start. Port 8080 was already in use.

cmd控制命令

netstat -ano | findstr 8080

然后kill杀死进程

taskkill /pid 14188 /f

ioc容器控制反转只能有一个id或者类.class
Java无法访问@test注解

尝试可能是多写了一个导入包

注释掉还是报错

plain 复制代码
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>RELEASE</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>RELEASE</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>RELEASE</version>
    <scope>compile</scope>
</dependency>
解决方法:

自己的版本要写两个,一个加入annotations,一个是test的时候导入

之后刷新重新启动就可以了

在spring的bean文件写list的ref对象bean出错

因为list集合的上面对象是Bankcard,写成了idcard

xml文件无法解析到bcard对象

idea文件中输入法失灵
jdk11版本和lombok不适配出错

java: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x1334c678) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x1334c678

修改后成功运行项目

java: 找不到符号 符号: 方法 getUserId()异常

maven位置报错,更换maven版本

415

编号

请求头 header 中的 Content-Type 类型:appliction/json。

302

请求暂时重定向,需要在头部加入脚本,描述当前页重定向的目标页

Failed to load resource: the server responded with a status of 404 (Not Found)

前后端跨域请求出问题

实际上404是前端的问题,把axios的服务器请求端口号写成了8081

自己的使用场景是:使用的后端8080,前端8081

写axios请求,请求的路由应该写后端,因为要连接的对象是后端,所以应该把8081写成8080

我的技术博客

相关推荐
泡泡以安18 分钟前
【Android逆向工程】第3章:Java 字节码与 Smali 语法基础
android·java·安卓逆向
毕设源码-朱学姐6 小时前
【开题答辩全过程】以 工厂能耗分析平台的设计与实现为例,包含答辩的问题和答案
java·vue.js
Spring AI学习7 小时前
Spring AI深度解析(9/50):可观测性与监控体系实战
java·人工智能·spring
java1234_小锋8 小时前
Spring IoC的实现机制是什么?
java·后端·spring
xqqxqxxq9 小时前
背单词软件技术笔记(V2.0扩展版)
java·笔记·python
猫头虎9 小时前
又又又双叒叕一款AI IDE发布,国内第五款国产AI IDE Qoder来了
ide·人工智能·langchain·prompt·aigc·intellij-idea·ai编程
消失的旧时光-19439 小时前
深入理解 Java 线程池(二):ThreadPoolExecutor 执行流程 + 运行状态 + ctl 原理全解析
java·开发语言
哈哈老师啊9 小时前
Springboot学生综合测评系统hxtne(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
java·数据库·spring boot
4311媒体网9 小时前
帝国cms调用文章内容 二开基本操作
java·开发语言·php
zwxu_9 小时前
Nginx NIO对比Java NIO
java·nginx·nio