文章分类 -  java / Spring

摘要:​ 使用Spring进行切面开发要先导入依赖 包括MVC里的AOP包 <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjweaver</artifactId> <version>1.9.4</version> </depen 阅读全文
posted @ 2023-10-08 18:30 哲_心 阅读(32) 评论(0) 推荐(0)
摘要:把上个案例进行修改 实现动态代理接口: public class Agencey implements InvocationHandler{ 编写set货源方法 private Insurance sellFamily; public Agencey(Insurance s) { sellFamil 阅读全文
posted @ 2023-10-07 15:59 哲_心 阅读(65) 评论(0) 推荐(0)
摘要:先看代码: 创建一个保险的接口,被卖保险的人继承, 中间商也卖同一份保险 这是中间商的代码: 结果: 中间商创建了一个有参构造, 把原厂的保险导入进来(他的货源) 因为他也能卖出保险,所有他也继承了保险接口 在卖保险的方法中调用了原厂的保险方法, 这个过程中就可以,利用代理商的身份赚取差价了.. 换 阅读全文
posted @ 2023-10-07 08:31 哲_心 阅读(15) 评论(0) 推荐(0)
摘要:user类: 转换结果: 注入参数还是上一篇所说的方法 支持最低版本spring4.1 运行方法要有所改变: 原来的: //获取配置文件 ApplicationContext context = new ClassPathXmlApplicationContext("application.xml" 阅读全文
posted @ 2023-10-06 17:33 哲_心 阅读(18) 评论(0) 推荐(0)
摘要:万能开头: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframe 阅读全文
posted @ 2023-10-06 13:59 哲_心 阅读(16) 评论(0) 推荐(0)
摘要:万能xml开头: <!--导入p,c命名空间 context注解 --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 阅读全文
posted @ 2023-10-06 10:46 哲_心 阅读(7) 评论(0) 推荐(0)
摘要:MVC 全部导入的xml头 <!--导入p,c命名空间 context注解 --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-insta 阅读全文
posted @ 2023-10-06 09:23 哲_心 阅读(18) 评论(0) 推荐(0)