摘要:
直接在类上添加@Component注解也可以创建bean,Configuration、Controller、Service、Repository直接继承了Component,只是在应用中语义不同,其他一样。比如Configuration作为创建bean的配置类使用,在其中的方法中用@Bean来创建b 阅读全文
posted @ 2019-11-02 17:51
雷雨客
阅读(407)
评论(0)
推荐(0)
摘要:
spring容器中bean初始化或者销毁时会执行一些方法,有3种实现方式。 1、实现InitializingBean、DisposableBean接口,在bean的属性设置后和bean销毁时分别执行afterPropertiesSet和destroy方法 pom.xml文件 <?xml versio 阅读全文
posted @ 2019-11-02 16:52
雷雨客
阅读(1181)
评论(0)
推荐(0)
浙公网安备 33010602011771号