- 博客(6)
- 收藏
- 关注
原创 在spring中反射创建实例,会绕过spring自动管理
获取对象,原因是因为绕开了Spring 的自动管理。1.思路一:通过spring的上下 文直接获取对象,在UserRefRoleImpl类中,每个都得通过applicationcontext去拿,有点耦合。2.思路二:直接想办法让spring扫描到UserRefRoleImpl,此时要改造一下工厂类,在通过反射创建对象时,手动注入依赖。当通过反射创建实例时,手动注入依赖需要小心处理,因为会绕过 Spring 的自动管理。5.如何修改,首先要有一个概念,获取不到对象的原因的是因为spring扫描不到它。
2023-08-23 17:05:35
177
原创 关于解决vue3的跨域问题
当我们使用vue3搭建前后端分离项目时,往往会出现跨域问题。前端往往会提示:例如,我这里,前端的项目的请求地址是http://localhost:8085/,访问后端的接口为http://localhost:8081/ResourcesCenter/BaseMapStyle/selectByPage,由于端口的不一致,所以出现了跨域问题。第一步:找到vue.config.js文件,添加如下代码:第二步,就是如何调用了本人亲试,已成功解决!...
2022-06-12 12:05:45
16029
7
原创 2021-01-16
javax.el.PropertyNotFoundException: Property [Xxxx] not found on type Xxx.xxx.xxxx.Xxxx]的解决办法坑坑坑!jsp页面使用${对象.属性},编写属性的entity类时不能用大写字母。本人亲测成功!
2021-01-16 19:48:21
134
原创 关于spring security 权限访问 403问题
spring security 在controller层使用方法级别注解 @PreAuthorize(“admin”)设置权限拦截问题,无权则返回403页面早在权限框架没有出来之前,进行权限的拦截一般使用路径拦截的方式,后者在配置文件中配置拦截信息spring security支持注解拦截的方式,其底层原理是过滤器,@PreAuthorize(“hasRole(‘xxx’)” )@PostAuthorize(“returnObject.type == authentication.name”)@S
2021-01-15 21:27:17
4923
原创 Springboot+thymeleaf 报Error resolving template [index], template might not exist的异常
Springboot+thymeleaf 报Error resolving template [index], template might not exist的异常Springboot+thymeleaf 报Error resolving template [login], template might not exist的异常1.首先看@controller是否用对当页面返回json格式时,使用@RestController当返回的是一个视图时,使用@Controller2.检查看配置文件中是
2021-01-13 21:10:19
463
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人