mybatis里Mapper.xml文件里sql语句写<或者>都会报错
报错
Error creating bean with name ‘carContronller’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.tellhow.Carsystem.service.CarService com.tellhow.Carsystem.controller.CarContronller.carService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘carService’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.tellhow.Carsystem.mapper.CarMapper com.tellhow.Carsystem.service.CarService.carMapper; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘carMapper’ defined in file [D:\java项目.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Carsystem\WEB-INF\classes\com\tellhow\Carsystem\mapper\CarMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’: : Error creating bean with name ‘sqlSessionFactoryBean’ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [D:\java项目.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Carsystem\WEB-INF\classes\com\tellhow\Carsystem\config\CarMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 36; 元素内容必须由格式正确的字符数据或标记组成。; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactoryBean’ defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘file [D:\java项目.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Carsystem\WEB-INF\classes\com\tellhow\Carsystem\config\CarMapper.xml]’; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance. Cause: org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 36; 元素内容必须由格式正确的字符数据或标记组成。
mybatis里的xml文件SQL语句报错
原因 :
<(小于号)和<> 一样,所以需要用转义符<(small it)
取代 >(大于号)同样如此,需要用转义符>;(big it)取代