228 questions
1
vote
1
answer
80
views
Is it possible to intercept extension method calls using `DispatchProxy`
I'm using DispatchProxy to create a "cached" IEnumerable<T> that will evaluate its elements once upon first enumeration, then buffer them for subsequent enumerations. I'm aware that ...
-1
votes
1
answer
75
views
Any downside of addAspect(sameAspect) millions of times?
The code I'm writing needs to intercept calls to object #2 (part of an external library) that is instantiated/retrieved on the fly by object #1 (also in the external library).
Therefore, I'm ...
0
votes
0
answers
51
views
Hook before @Autowire (constructor and variable)?
Is there any possibility to execute some code before every autowiring (for method and variable autowiring)? Because under some circumstances I want to add a primary component before this autowire/...
0
votes
1
answer
1k
views
Different between CGLIB proxy and JDK proxy on Spring AOP perspective
Baeldung has this section:
this limits matching to join points where the bean reference is an
instance of the given type, while target limits matching to join
points where the target object is an ...
3
votes
1
answer
1k
views
cglib proxy and null instance variable internals
My query is why is an instance variable null when cglib proxy with spring tries to access it inside a final method. This would mean that even if I had declared the variable directly like in the class ...
0
votes
0
answers
301
views
Intercept methods calls of existing DLL at Runtime
How to intercept methods calls during runtime, For example, I have a DLL of my application that contains some methods that I would like to bypass or intercept to add some logs.
Can I use some ...
1
vote
0
answers
251
views
Java Reflection. Unable to create java.reflect.Proxy because of 'Methods with same signature'
I am trying to make a Proxy class that implements a class called Player.
public Player asPlayer() {
return (Player) Proxy.newProxyInstance(Player.class.getClassLoader(),
new ...
0
votes
1
answer
207
views
No qualifying bean of type exception when added custom beanpostprocessor and trying to get beans that are classes
I'm learning proxy usage in java and want to log time of method's execution.
All of this components are placed in com.example.testproxyproject package.
I have Order interface which is implemented by ...
0
votes
0
answers
336
views
Calling private methods of a proxied outer bean by inner bean leads to NullPointerException on accessing outer bean property
First, about the problem I try to solve.
Imagine there is an EntityPersistentAdapter which works with some abstraction over SQL (querydsl is used in my case). This adapter implements many CRUD ...
1
vote
1
answer
658
views
DryIoc open generic interception with castle core
I want to register open generic interception, so I modified explample from https://github.com/dadhi/DryIoc/blob/master/docs/DryIoc.Docs/Interception.md
[TestFixture]
public class UnitTest3
{
...
-2
votes
1
answer
664
views
I am having trouble in using jdk dynamic proxy
Before using spring aop and cglib, Now I replaced a simple example.I found that executing method sayHello1 () and sayHello2 () both output "before" and "after" Oh my god, it's very difficult, Do you ...
1
vote
1
answer
610
views
Endless loop and StackOverflow with a proxy
I'm trying to make the tricky thing. I have method ObjectFactory.getObject() which returns an Object that needs to implement Serializable. I'm trying to make a proxy of an already existing instance of ...
1
vote
1
answer
739
views
Which feature of kotlin can be used as a replacedment of method interception via java proxies
In java if I want to intercept the method calls on a class I can use Proxy.newProxyInstance() and provide an InvocationHandler implementing invoke().
I've seen that in kotlin you can use delegated ...
-1
votes
1
answer
345
views
Is there something wrong [closed]
I am learn cglib proxy, When I use Person class which declared in the DemoApplication class as the target of super class of enhancer, there will be a error like this.
This is my code
public class ...
0
votes
1
answer
537
views
A Java config analog of XML configuration not working
TL/DR: The problem boils down to creating a custom Spring scope, injecting a prototype-like scoped bean into a singleton with proxyMode = ScopedProxyMode.TARGET_CLASS but still getting a singleton in ...
3
votes
1
answer
773
views
Why don't I experience any exception when I lookup bean wrapped by JDK dynamic proxy by class(instead of interface)?
Lets consider following bean:
@Service
@Scope(value = "prototype", proxyMode = ScopedProxyMode.INTERFACES)
public class MyBeanB implements MyBeanBInterface {
private static final AtomicLong ...
8
votes
3
answers
1k
views
Multiple type parameters in Java methods, including existing classes and primitive data types
I have a class with code like the following, where I want it to be trivial to use any class/type which represents a number. I find myself defining a large amount of methods, like the following:
...
8
votes
1
answer
3k
views
Self-invocation behaviour in @Configuration vs. @Component classes
My question is about AOP Spring behaviour in case of internal method calls.
@Service
class Service {
@Transactional
public void method1() {
method2();
}
@Transactional
...
2
votes
1
answer
539
views
Should calls on a dynamic proxy go to the method of the dynamic type or the static type?
The method-object, which the dynamic proxy receives, seems to be of the reference type instead of the object type, but only when generics are involved in the method signature. Should it work that way?
...
3
votes
2
answers
250
views
Kotlin strange behaviour when calling extension function on java.lang.reflect.Proxy object
Today I played with some java.lang.reflect.Proxy in Kotlin, and I was surprised by this behaviour:
import java.lang.reflect.Proxy
interface Dog {
fun bark()
fun bark3Times()
}
class DogImpl : ...
1
vote
0
answers
44
views
StructureMap interceptor and DynamicProxy
I am trying to upgrade StructureMap from 2.6 to 4.7. I had an interceptor which creates and return proxy.
public object Process(object target, IContext context)
{
Type targetType = ...
1
vote
1
answer
258
views
Resolve EF dynamic proxy in Autofac
I'm using Entity Framework and have registered some types for use in a factory class.
Registration is performed using Keyed like this:
builder.RegisterType<CreateTypeAStrategy>().Keyed<...
0
votes
1
answer
93
views
Synchonizing on Java Class<T> instance to store and retrieve Dynamically created Proxy classes at runtime
In our web application exists 'Access Bean' classes with some methods on them which perform queries on a DB, these are invoked multiple times per request. Therefore they need to be cached but the ...
2
votes
1
answer
3k
views
Async Interception using Castle dynamic proxy
I'm trying to build a dynamic http client using dynamic proxy to intercept the calls and create an http request with it.
The issue i had was with Async methods:
private Task<object> PostAsync(...
0
votes
1
answer
97
views
How can I log webdriver calls, proxy is not working
I'm attempting to write a proxy for RemoteWebDriver to add custom logging for methods such as findElement etc. As an experiment I found a TimingHandler that just provides a start/stop time stamp for ...