JaxWsPortProxyFactoryBean Aspects Not Being applied
I have a class that extends from org.springframework.remoting.jaxws.JaxWsPortProxyF actoryBean and in this extension class, I have my own annotations that are picked up by my AspectJ based aspects. It is something like:
Code:
@Log
@Profile
public class JaxWsPortProxyFactoryBean extends
org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean {
... impl
}
Here is the unit test that I'm using that shows that any other class does get it applied:
Code:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(loader = AnnotationConfigContextLoader.class)
public class ProxyTest {
@Log
@Profile
static class AnnontationClass {
public void testMe() { System.out.println("Are we proxied?"); };
}
@Configuration
@EnableAspectJAutoProxy
@ComponentScan(basePackages = {"com.capitalone.epf.logging", "com.capitalone.epf.servicelocator"})
static class ContextConfiguration {
@Bean
public ConfigBasedEndpointLocator configBasedEndpointLocator()
{
return createNiceMock(ConfigBasedEndpointLocator.class);
}
@Bean
public EPFConfigurationUtils configUtils()
{
return createNiceMock(EPFConfigurationUtils.class);
}
@Bean
public EndpointLocator locator()
{
return createNiceMock(EndpointLocator.class);
}
@Bean
public EndpointManager endpointManager()
{
return createNiceMock(EndpointManager.class);
}
@Bean
public AnnontationClass local()
{
return new AnnontationClass();
}
@Bean
public JaxWsPortProxyFactoryBean proxy() throws Exception {
JaxWsPortProxyFactoryBean proxy = new JaxWsPortProxyFactoryBean();
proxy.setServiceInterface(OnLineServicingHAServiceSoap.class);
proxy.setWsdlDocumentUrl(ClassLoader.getSystemResource("META-INF/wsdls/OnLineServicingHAService.wsdl"));
proxy.setNamespaceUri("http://capitalone.com/OnLineServicingHAService/V1");
proxy.setServiceName("OnLineServicingHAService");
return proxy;
}
}
// DOESNT get proxied
@Inject
public JaxWsPortProxyFactoryBean proxy;
// DOES get proxied
@Inject
public AnnontationClass local;
@Test
public void testHappyPath() {
System.out.println("proxy: " + proxy);
}
}
Thoughts on why this might be happening? I have tried setting the proxy attributes on the component scan, but that doesn't seem to have any effect.