From 42130246e1c56fb58395c8c12eb32bb788b88169 Mon Sep 17 00:00:00 2001 From: Gary Russell Date: Wed, 16 Apr 2014 15:43:29 -0400 Subject: [PATCH] INT-2974 Document Context Lifecycle + Fix JIRA: https://jira.spring.io/browse/INT-2974 JIRA: https://jira.spring.io/browse/INT-3071 --- src/reference/docbook/file.xml | 2 +- src/reference/docbook/overview.xml | 46 ++++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/reference/docbook/file.xml b/src/reference/docbook/file.xml index 1ce101d70e..4b3ff0abc1 100644 --- a/src/reference/docbook/file.xml +++ b/src/reference/docbook/file.xml @@ -28,7 +28,7 @@ This is an implementation of MessageSource that creates messages from a file system directory. ]]> + p:directory="${input.directory}"/>]]> To prevent creating messages for certain files, you may supply a diff --git a/src/reference/docbook/overview.xml b/src/reference/docbook/overview.xml index 72ab123c7d..223b88a74b 100644 --- a/src/reference/docbook/overview.xml +++ b/src/reference/docbook/overview.xml @@ -368,15 +368,43 @@ on @Bean methods within @Configuration classes. In either case, the bean must be a ChannelInterceptor. - - The @IntegrationConverter annotation has been introduced to - mark Converter, GenericConverter or - ConverterFactory beans as candidate converters for integrationConversionService. - This annotation is an analogue of the <int:converter> xml element - (see ). @IntegrationConverter annotations - can be placed at the class level (with a @Component stereotype annotation), or - on @Bean methods within @Configuration classes. - + + The @IntegrationConverter annotation has been introduced to + mark Converter, GenericConverter or + ConverterFactory beans as candidate converters for integrationConversionService. + This annotation is an analogue of the <int:converter> xml element + (see ). @IntegrationConverter annotations + can be placed at the class level (with a @Component stereotype annotation), or + on @Bean methods within @Configuration classes. + +
+ Programming Considerations + + It is generally recommended that you use plain old java objects (POJOs) whenever possible and only + expose the framework in your code when absolutely necessary. + + + If you do expose the framework to your classes, + there are some considerations that need to be taken into account, especially during application startup; some of + these are listed here. + + + + If your component is ApplicationContextAware, you should generally not "use" + the ApplicationContext in the setApplicationContext() method; + just store a reference and defer such uses until later in the context lifecycle. + + + If your component is an InitializingBean or uses @PostConstruct + methods, do not send any messages from these initialization methods - the application context is not + yet initialized when these methods are called, and sending such messages will likely fail. + If you need to send a messages during startup, implement ApplicationListener + and wait for the ContextRefreshedEvent. Alternatively, implement + SmartLifecycle, put your bean in a late phase, and send the messages + from the start() method. + + +