org.xml.sax.SAXParseException: Element type "select" must be followed by attribute specification ">" or "/>

Project scenario:

The springBoot project build is successfully compiled, and the maven dependencies are all right. When the project starts the run service, an exception is reported:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'demoUserController': Unsatisfied dependency expressed through field 'demoUserService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'demoUserServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'demoUserMapper' defined in file [E:\workspace\financial-attendance\target\classes\com\luntek\financialattendance\mapper\DemoUserMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException:Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\workspace\financial-attendance\target\classes\mapper\StProjectApproveMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 104; columnNumber: 28; 元素类型 "select" 必须后跟属性规范 ">" 或 "/>"。28; Element type "select" must be followed by attribute specification ">" or "/>".


Problem description and analysis

The problem is already very clear. The instance of the mapper.xml file failed to be created. It also pointed out that there is a problem with ` \mapper\StProjectApproveMapper.xml` lineNumber: 104; columnNumber: 28 `104 lines and 28 columns of this xml file


solution:

It has been positioned to write the select statement, and there is one space missing when setting the parameter type of ` parameterType` . Just fill it up. 

Summarize:

The springBoot project build compilation will not check the syntax of xml. The mapper.xml file is the java virtual machine that checks and reports errors when the project is running and creates file instances based on mybaits. Don’t panic if you encounter problems. The error log looks like this.

Guess you like

Origin blog.csdn.net/Da_zhenzai/article/details/132400913