Skip to content

Instantly share code, notes, and snippets.

@ttddyy
Created February 4, 2019 22:54
Show Gist options
  • Save ttddyy/e1bf41fcd8d8fdf88d90f7ca8cd503ab to your computer and use it in GitHub Desktop.
Save ttddyy/e1bf41fcd8d8fdf88d90f7ca8cd503ab to your computer and use it in GitHub Desktop.
Wrap result of ConnectionFactory#create()
class Pointcut {
// pointcut for ConnectionFactory#create() method
public Publisher<? extends Connection> pointcut() {
Publisher<? extends Connection> result = null; // actual result of "ConnectionFactory#create()"
ProxyFactory proxyFactory = null; // need to construct
// return wrapped one
return Flux.from(result)
.flatMap(origiinalConn -> {
ConnectionInfo connectionInfo = null; // need to construct it
Connection wrappedConn = proxyFactory.wrapConnection(origiinalConn, connectionInfo);
return Mono.just(wrappedConn);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment