Code: Select all
@Target({ElementType.METHOD, ElementType.TYPE, ElementType.FIELD})
@Retention(RUNTIME)
public @interface MyCustomAnnotation {
}
Code: Select all
@MyCustomAnnotation
@Component
public class CoreBusinessLogicHandler implements GenericHandler {
// some business logic
}
Code: Select all
@Configuration
public class BusinessConfig {
@Autowired
private CoreIntegrationComponent coreIntegrationComponent;
@MyCustomAnnotation
@Bean(name = INCOMING_PROCESS_CHANNEL)
public MessageChannel incomingProcessChannel() {
return coreIntegrationComponent.amqpChannel(INCOMING_PROCESS_CHANNEL);
}
//some other configurations
}
Code: Select all
import org.springframework.context.ApplicationContext;
@Configuration
public class ChannelConfig {
@Autowired
private ApplicationContext applicationContext;
public List getRecipientChannel(CoreIntegrationComponent coreIntegrationComponent) {
String[] beanNamesForAnnotation = applicationContext.getBeanNamesForAnnotation(MyCustomAnnotation.class);
//Here in output I am getting bean name for CoreBusinessLogicHandler Only.
}
}