-
Jun 19th, 2012, 03:53 PM
#1
Spring + myBatis - Result Maps collection already contains value problem
I am having a problem integrating myBatis with Spring.
I followed the 3-part tutorial here: http://www.raistudies.com/spring/spr...batisibatis-3/
And when I deploy it to my web server (weblogic) I get the error:
Result Maps collection already contains value for com.test.TestService.testResultMap
I think Spring is creating the thing twice, but I dont know why it is doing that.
In the logs, I see that prior to this error there is this output: MapperScannerConfigurer.java:404 - Creating MapperFactoryBean with name 'testService' and 'com.test.TestService' mapperInterface.
No errors here, seems it loads just fine.
Then some other debug stuff before finally seeing the error this thread is about, associated with the class:
MapperFactoryBean.java:97 - Error while adding the mapper 'interface com.test.TestService' to configuration.
in the stack trace I see this gets called by spring's AbstractAutowireCapableBeanFactory
So what could be going on? Why is Spring creating my service twice resulting in this error?
I just have one spring config xml entry where I use MyBatis MapperScannerConfigurer and pass it my service's package name. It looks like the first debug output where it create the TestService first time fine is from this. The second time it's created is from some Autowired config, so I look in my class, which is a Controller and see:
public class TestController {
private TestService testService;
@Autowired
public TestController (TestService testService) {
this.testService = testService;
}
}
I have no other configurations or annotations referencing TestService anywhere in my project.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules