Code example for ProxyFactory

Methods: getProxy, addAdvice

0
	public void returnValue() { 
		PublisherMetadataSource metadataSource = new TestPublisherMetadataSource(); 
		MessagePublishingInterceptor interceptor = new MessagePublishingInterceptor(metadataSource); 
		interceptor.setBeanFactory(beanFactory); 
		interceptor.setChannelResolver(channelResolver); 
		ProxyFactory pf = new ProxyFactory(new TestBeanImpl()); 
		pf.addAdvice(interceptor); 
		TestBean proxy = (TestBean) pf.getProxy(); 
		proxy.test(); 
		Message<?> message = testChannel.receive(0); 
		assertNotNull(message); 
		assertEquals("test-foo", message.getPayload()); 
	} 
 
	@Test 
	public void demoMethodNameMappingExpressionSource() { 
		Map<String, String> expressionMap = new HashMap<String, String>(); 
		expressionMap.put("test", "#return"); 
		MethodNameMappingPublisherMetadataSource metadataSource = new MethodNameMappingPublisherMetadataSource(expressionMap); 
		Map<String, String> channelMap = new HashMap<String, String>(); 
Contextual code suggestions in your IDE  Get Codota for Java