摘要:
spring的事件,为Bean与Bean之间通信提供了支持,当一个Bean处理完成之后,希望另一个Bean知道后做相应的事情,这时我们就让另外一个Bean监听当前Bean所发送的事件。 spring的事件应该遵循: 1.自定义事件,集成:ApplicationEvent 2.自定义事件监听,实现Ap 阅读全文
posted @ 2017-12-26 18:24
午火39
阅读(636)
评论(0)
推荐(0)
摘要:
1.通过设定Environment的ActiveProfile来设置当前context所需要的环境配置,在开发中使用@Profile注解类或方法,达到不同情况下选择实例化不同的Bean. 2.使用jvm的spring.profiles.acitve的参数来配置环境 3.web项目设置在Servlet 阅读全文
posted @ 2017-12-26 17:03
午火39
阅读(4024)
评论(0)
推荐(0)
摘要:
import org.springframework.context.annotation.AnnotationConfigApplicationContext; 使用AnnotationConfigApplicationContext可以实现基于Java的配置类加载Spring的应用上下文.避免使 阅读全文
posted @ 2017-12-26 15:23
午火39
阅读(2164)
评论(0)
推荐(0)
摘要:
@Service用于标注业务层组件 : 将当前类注册为spring的Bean @Controller用于标注控制层组件(如struts中的action) @Repository用于标注数据访问组件,即DAO组件 @Component泛指组件,当组件不好归类的时候,我们可以使用这个注解进行标注。: 将 阅读全文
posted @ 2017-12-26 11:40
午火39
阅读(5268)
评论(0)
推荐(0)
摘要:
实例一: UseFunctionService 文件: 运行Main.java ,结果为 hello word 阅读全文
posted @ 2017-12-26 11:34
午火39
阅读(2007)
评论(0)
推荐(0)
摘要:
1.在maven 的pom.xml中加入 2.右击下项目:maven->update project更新 阅读全文
posted @ 2017-12-26 11:28
午火39
阅读(1554)
评论(0)
推荐(0)