Problems encountered in Spring+mybatis+maven integration

1. When this error occurred, I thought that the schema of the transaction could not be accessed, but later I found out that spring-tx was not imported! Record

Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/tx]
Offending resource: class path resource [spring-mybatis.xml]

 

 

2. Sometimes spring prompts that a DAO cannot be injected, but in fact spring has already configured DAO scanning.

Carefully check the error print log, see that there is an error in mapper.xml, delete the mapper configuration line by line, and finally return to the existing line <result /> neither column nor property is written, so an error is reported. Remove it and it works fine.

 

3. It is very convenient to use Navicate to generate query statements, but you must remember that after modifying the alias, the following must be modified accordingly.

When doing the exercise, because I wrote an association query above, I changed the alias in the resultMap, and when I copied it to the next deeper association query, I forgot to change the alias in the query statement, and the number of results was not correct, so I searched for a long time. . Record it here. If the record is wrong in the future, go directly to find out whether the associated ID has an alias, and whether the alias is used when mapping

 

4 When maven install keeps prompting that tools.jar cannot be found

Two steps:

0. The first place to check should refer to this: http://stackoverflow.com/questions/5756299/maven-3-artifact-problem

Add in the eclipse.ini file

-vm
C:\Program Files\Java\jdk1.6.0_32\bin\javaw.exe

 

1. Add jdk_home/lib/tools.jar to the classpath environment variable

2. Right-click the project, delete the jre system library in the libraries in the project buildpath, and then add it again.

Otherwise, no matter how many times you check it, it has no effect. You must remove it and add it again.

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326529296&siteId=291194637