网站制作成都,网站建设中可能出现的问题,长尾关键词搜索网站,静态页面加wordpress一、vue的跨域问题
1、前端本地用代理软件代理服务器
在vue项目下的 config/index.js 文件里面配置代理proxyTable:proxyTable: {/login: {target: http://192.168.1.1:8080/ntd/data,changeOrigin: true,pathRewrite: {^/login:}}2、后台服务器开启允许跨域的响应头
直接在tom…一、vue的跨域问题
1、前端本地用代理软件代理服务器
在vue项目下的 config/index.js 文件里面配置代理proxyTable:
proxyTable: {/login: {target: http://192.168.1.1:8080/ntd/data,changeOrigin: true,pathRewrite: {^/login:}}2、后台服务器开启允许跨域的响应头
直接在tomcat安装目录下的lib中添加cors-filter-1.7.jarjava-property-utils-1.9.jar 这2个jar包并且在业务项目的web.xml 中配置想要应的filter配置文件
filterfilter-nameCORS/filter-namefilter-classcom.thetransactioncompany.cors.CORSFilter/filter-class
/filter
filter-mappingfilter-nameCORS/filter-nameurl-pattern/*/url-pattern
/filter-mapping二、Hibernate的hql不允许属性作为参数注入三、SpringMVC注入不了泛型属性只能注入泛型方法
1多Dao对象失败
public abstract class ServiceT extends Serializable,D extends DaoT {//多个Dao对象会注入失败Autowired protected D dao;}2正确匹配泛型
public abstract class ServiceT extends Serializable,D extends DaoT{protected D dao;Autowiredpublic void setDao(D dao) {this.dao dao;}
}四、SpringMVC不能把Hibernate懒惰加载的对象转换为json
1在懒惰对象上加JsonIgnore来忽视对象
2在对象上加fecthFecth.EAGER设置不懒惰加载五、jquery跨域请求不能匹配服务端的session解决不匹配seesion问题
$.ajax({url:url,//加上这两句话xhrFields: {withCredentials: true},crossDomain: true,//穿透
success:function(result){},error:function(){}
});六、Axios的post方法提交数据SpringMVC不能解析1用URLSearchParams传递参数
import axios from axios;let param new URLSearchParams();param.append(account, admin);param.append(password, admin);export async function () {axios.post(/ntd/login, param)
}2改写axios.default.transformRequest参考axios发送post请求springMVC接收不到数据问题
3将SpringMVC的RequestParam改为RequestBody 七、vue的props、model、data、methods和watch等由Vue定义的字段或者属性使用箭头函数赋值箭头函数中的 this不是指向 vue 实例而是vue的原型对象八、Bean类属性没有getter方法SpringMVC的json无法解析属性
json
九、SQL的order by后直接group by无法解析group by
由于order by 优先级低故解析不了后面的group by十、SpringMVC的junit4无法加载context错误为Error applying BeanValidation relational constraints
原因hibernate验证失败。
在hibernate.hbm.xml中加上property namejavax.persistence.validation.modenone/propertyjavax.persistence.validation.mode默认情况下是auto的就是说如果不设置的话它是会自动去你的classpath下面找一个bean-validation**包但是找不到所以beanvalitionFactory错误十一、No Session found for current thread
1.事务xml配置设置proxy-target-classtrue2.事务注解设置proxy-target-classtrue与Transiational的类方法继承问题与接口方法继承问题
十二、SpringMVC配置事务创建不了bean1.事务默认代理使用接口代理
2.使用cglib类代理设置proxy-target-classtrue
十三、Abandoned connection cleanup thread问题
mysql的jdbc包5.1.15的问题
十四、Hibernate的数据库连接池无法释放连接导致请求等待
1.Hibernate的getCurrentSession方法配置事务与openSession方法必须close
2.事务的配置