Hello,
I have a service that's exposed by HttpInvoker (org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter) and a
test class with some tests.
applicationContext.xml
logRequisicao-servlet.xml
applicationContext-client.xml
TestClass
The problem is that my class (LoggerRequisicao) isn't thread-safe, so i can't have only one instance shared for all remote invocations. That's where my problems have started. I spent a good time looking for something about and i know i can define another scope for the bean different than singleton, which is the default. I tried different ways:
1)
applicationContext.xml
logRequisicao-servlet.xml
Result: Just one instance is created. It's the same behavior when i hadn't defined the bean logRequisicaoService scope as prototype.
2)
applicationContext.xml
logRequisicao-servlet.xml
Result: One instance is created for each method call. For example:
3 or 4 instances would be created.
What i really need is that 1 instance was created by each getBean called. In the Test Class, 1 instance per test. I really researched about it and tested different ways, but i couldn't be able to make it works.
Does somebody have any idea of how to solve that problem?
Thank you veru much.
Luciano
Ps.: Sorry for the english