摘要: 动态代理模板 /** * Description : * 公用这个类,自动生成代理类 * * @author : AirCL * Date : 2021/2/4 * Time : 20:27 */ public class ProxyInvocationHandler implements Invo 阅读全文
posted @ 2021-02-04 20:35 AirCL 阅读(65) 评论(0) 推荐(0)
摘要: 在Spring项目中,我们也可以不通过配置文件applicationContext.xml来配置,而可以使用@Configuration注解,可以让我们完全脱离配置文件的苦恼。 示例: 1.config包 @Configuration @ComponentScan("com.aircl.domain 阅读全文
posted @ 2021-02-04 18:31 AirCL 阅读(113) 评论(0) 推荐(0)
摘要: Spring 4.x之后,如果需要使用注解进行开发,需要先导入aop包 然后加入context约束 接着打开注解和注解扫描(domain为博主的实体类包名) <!--开启注解--> <context:annotation-config/> <!--开启注解扫描包,将会自动扫描这个包下的注解--> < 阅读全文
posted @ 2021-02-04 17:15 AirCL 阅读(87) 评论(0) 推荐(0)
摘要: 在Spring中有三种装配bean的方式: 1.在xml中显示的配置 这是我们之前一直在使用的方法 <bean id="helloBean" class="com.aircl.domain.Hello"> <property name="str" value="Hello Spring"></pro 阅读全文
posted @ 2021-02-04 14:54 AirCL 阅读(90) 评论(0) 推荐(0)
摘要: Spring官方给出的bean作用域如下 1. 单例模式 单例模式是Spring的默认机制,每次从容器中get的时候,都会创建一样的对象 <bean id="helloBean" class="com.aircl.domain.Hello" scope="singleton"> <property 阅读全文
posted @ 2021-02-04 13:12 AirCL 阅读(73) 评论(0) 推荐(0)