当前位置: 首页 > news >正文

浏览不良网站会被网警抓吗什么软件可以看到街景

浏览不良网站会被网警抓吗,什么软件可以看到街景,那个网站建设好,佛山 建站公司代码地址 https://github.com/cmdch2017/JDKproxy.git/ 我的理解 我的理解是本身service-serviceImpl结构#xff0c;新增一个代理对象proxy#xff0c;代理对象去直接访问serviceImpl#xff0c;在proxy进行事务的增强操作#xff0c;所以代理对象实现了接口。如何实现…代码地址 https://github.com/cmdch2017/JDKproxy.git/ 我的理解 我的理解是本身service-serviceImpl结构新增一个代理对象proxy代理对象去直接访问serviceImpl在proxy进行事务的增强操作所以代理对象实现了接口。如何实现动态呢需要实现InovacationHandler接口并用反射调用invoke方法实现类似于泛型一样的效果。 CHATGPT回答 “JDK动态代理是通过Proxy类和InvocationHandler接口实现的。它允许在运行时生成代理类无需事先定义代理类从而在不修改原有代码的情况下对方法进行增强。通过实现InvocationHandler接口我们可以在目标方法执行前后插入自定义逻辑比如事务处理。动态代理的优势在于避免了手动创建大量代理类的繁琐工作使代码更加简洁和易维护。” 核心代码 客户端 public class TestStudent {public static void main(String[] args) { // testQuery(1);testQueryObject(1);} //这里是动态代理多实现了一个InvocationHandlerprivate static void testQueryObject(int id) {DaoTransaction transactionnew DaoTransaction();StudentServiceImpl studentServicenew StudentServiceImpl();TransactionHandler transactionHandlernew TransactionHandler(studentService,transaction);StudentService proxyInstance(StudentService)Proxy.newProxyInstance(StudentServiceImpl.class.getClassLoader(),StudentServiceImpl.class.getInterfaces(),transactionHandler);Student studentproxyInstance.query(id);System.out.println(id:student.getId(),name:student.getName());} //这里是静态代理private static void testQuery(int id) {DaoTransaction transactionnew DaoTransaction();StudentServiceImpl studentServicenew StudentServiceImpl();ProxyStudent proxyStudentnew ProxyStudent(studentService,transaction);Student studentproxyStudent.query(id);System.out.println(id:student.getId(),name:student.getName());} }动态代理学生 public class TransactionHandler implements InvocationHandler {private DaoTransaction daoTransaction;private Object object;public TransactionHandler(Object object, DaoTransaction daoTransaction) {this.object object;this.daoTransaction daoTransaction;}Overridepublic Object invoke(Object proxy, Method method, Object[] args) throws Throwable {return method.invoke(object,args);} }Data public class Student {private int id;private String name; }静态代理学生 public class ProxyStudent implements StudentService {private StudentServiceImpl studentService;private DaoTransaction daoTransaction;public ProxyStudent(StudentServiceImpl studentService, DaoTransaction daoTransaction) {this.studentService studentService;this.daoTransaction daoTransaction;}Overridepublic Student query(int id) {daoTransaction.startTransaction();Student studentstudentService.query(id);daoTransaction.endTransaction();return student;} }public class StudentServiceImpl implements StudentService {Overridepublic Student query(int id) {System.out.println(执行查询);Student studentnew Student();student.setId(id);student.setName(lst);return student;} }public interface StudentService {Student query(int id); } public class DaoTransaction {public void startTransaction() {System.out.println(开启事务);}public void endTransaction() {System.out.println(关闭事务);} }
http://www.tj-hxxt.cn/news/225021.html

相关文章:

  • 大连淘宝网站建设搜索引擎优化工具
  • 18款禁用网站app破解版智加设计
  • 制作网站的手机软件平台管理系统登录
  • 建网站 3年服务器西安网站设计西安搜推宝
  • 网站模板修改教程南宁企业网站建设
  • 卖域名做非法网站企业微信管理软件
  • 哪里有网站建设项目网站建设付费项目
  • 湘潭企业网站建设百度一下你就知道了百度一下
  • 找做仿网站怎么补网站漏洞
  • 用php做的网站必备那些文件专业网站建设是哪家便宜
  • 开源cms建站WordPress文章过滤
  • 建个站的网站打不开辛集做网站公司
  • 哪些购物网站做的比较简洁有品质wordpress弹窗
  • 湘潭市 网站建设如何做双语网站
  • 网站营销单页怎么设计方案招投标网站开发费用
  • 诚讯通网站网站的建设
  • 西安营销网站建设公司做网站彩票代理多少钱啊
  • 手机网站怎么做域名解析广州英文建站公司
  • 扁平化手机网站模板陕西省平安建设网站
  • 专业的网站开发公司电话上海做网站天锐
  • 装潢公司网站源码php封面设计用什么软件做
  • 网站建设 案例展示网站原型怎么做
  • 网站建设预计资金投入天美传媒传媒官网免费下载
  • 廊坊网站搜索优化百度搜索引擎怎么做
  • 广州网站建设菲利宾手机百度下载安装
  • 长春做高端网站公司营销推广内容
  • 那个网站做图片比较赚钱售后好的品牌策划公司
  • 黑龙江省住房和建设厅网站首页洛阳理工学院教务管理系统
  • 个人无网站怎样做cps广告电子报刊的传播媒体是什么
  • 什么网站好建设wordpress支付宝当面付插件