From a component with RequestScope
etc., I had to return a class that holds the proxy (because it is checked for equivalence where I can't touch it).
I don't know if this was good, but I was able to realize myself by ʻAutowired`.
@Component
@RequestScope
public class Hoge {
private final Hoge proxyInstance;
@AutoWired
public(Hoge proxyInstance) {
if (!(proxyInstance instanceof ScopedObject)) {
throw new IllegalArgumentException("Pass the proxy");
}
this.proxyInstance = proxyInstance;
}
public Fuga getFuga() {
return new Fuga(proxyInstance);
}
}
Recommended Posts