• Property 'mapperLocations' was not specified or no matching resources found org.apache.ibatis.builder.BuilderException: Could not find value method on SQL annotation


    这个问题,其实以前也碰到过,并且已经解决。

    但是不巧的事又碰到了,看到问题,知道是mapper里面的问题,但看了半天,好像也没有错。

    Scanned package: 'com.Xxxx.XX.model' for aliases
    Property 'mapperLocations' was not specified or no matching resources found
    16:21:16.905 [restartedMain] ERROR o.m.spring.mapper.MapperFactoryBean - Error while adding the mapper 'interface com.Xxxx.XX.mapper.XXMapper' to configuration.
    org.apache.ibatis.builder.BuilderException: Could not find value method on SQL annotation.  Cause: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 223; The content of elements must consist of well-formed character data or markup.
        at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.getSqlSourceFromAnnotations(MapperAnnotationBuilder.java:472)
        at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parseStatement(MapperAnnotationBuilder.java:289)
        at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.parse(MapperAnnotationBuilder.java:134)
        at org.apache.ibatis.binding.MapperRegistry.addMapper(MapperRegistry.java:72)
        at org.apache.ibatis.session.Configuration.addMapper(Configuration.java:728)
        at org.mybatis.spring.mapper.MapperFactoryBean.checkDaoConfig(MapperFactoryBean.java:80)
        at org.springframework.dao.support.DaoSupport.afterPropertiesSet(DaoSupport.java:44)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1845)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1782)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:925)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332)
        at com.Xxxx.Xx.XXXApplication.main(XXXApplication.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
    Caused by: org.apache.ibatis.builder.BuilderException: Error creating document instance.  Cause: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 223; The content of elements must consist of well-formed character data or markup.
        at org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:259)
        at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:115)
        at org.apache.ibatis.scripting.xmltags.XMLLanguageDriver.createSqlSource(XMLLanguageDriver.java:51)
        at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.buildSqlSourceFromStrings(MapperAnnotationBuilder.java:482)
        at org.apache.ibatis.builder.annotation.MapperAnnotationBuilder.getSqlSourceFromAnnotations(MapperAnnotationBuilder.java:465)
        ... 29 common frames omitted

    解决:

    问题在于用了时间比较的 >=     <=

    这样就会报错,应该用转义的字符。&gt;=     &lt;=

    这个与html中的一致。

    以上的表格来于:https://blog.csdn.net/qq_27918787/article/details/52658458

    道法自然
  • 相关阅读:
    bzoj4152-[AMPPZ2014]The_Captain
    bzoj3209-花神的数论题
    [模板] 数位dp
    [西安交大附中集训] 自积
    [模板] 后缀数组
    [模板] 哈希表
    [西安交大附中集训] d6 删边(cip)
    java 发布订阅
    Spring Boot使用@Async实现异步调用:自定义线程池
    上传文件到服务器或者直接输出到输出流
  • 原文地址:https://www.cnblogs.com/jiduoduo/p/15169876.html
Copyright © 2020-2023  润新知