20:28:33.382 [restartedMain] ERROR org.springframework.boot.SpringApplication - Application run failed java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.yml' at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:524) ....... Caused by: java.nio.charset.MalformedInputException: Input length = 1 at java.nio.charset.CoderResult.throwException(CoderResult.java:281) at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:339) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178) at java.io.InputStreamReader.read(InputStreamReader.java:184) at org.yaml.snakeyaml.reader.UnicodeReader.read(UnicodeReader.java:125) at org.yaml.snakeyaml.reader.StreamReader.update(StreamReader.java:183) ... 46 common frames omitted
这主要是说明了 application.yml文件可能是在某些编辑器(如 Windows 记事本)中以 GBK 或其它非 UTF-8 编码保存的,而 Spring Boot 默认使用 UTF-8 编码来读取配置文件
Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Sep 18 21:04:32 CST 2025 There was an unexpected error (type=Internal Server Error, status=500). ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'tmalldemodb.productOrder.productorder_pay_date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by ### The error may exist in file [E:\safety\CodeAudit\TmallDemo-master\target\classes\mapper\ProductOrderMapper.xml] ### The error may involve defaultParameterMap ### The error occurred while setting parameters ### SQL: SELECT productOrder_pay_date,count(productOrder_id) as productOrder_count ,productOrder_status from productOrder WHERE productOrder_pay_date BETWEEN ? AND ? GROUP BY DATE_FORMAT(productOrder_pay_date,'%Y-%m-%d'),productOrder_status ### Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'tmalldemodb.productOrder.productorder_pay_date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'tmalldemodb.productOrder.productorder_pay_date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by org.springframework.jdbc.BadSqlGrammarException: ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'tmalldemodb.productOrder.productorder_pay_date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by ### The error may exist in file [E:\safety\CodeAudit\TmallDemo-master\target\classes\mapper\ProductOrderMapper.xml] ........
不知道这个报错是不是和我上面改了一个依赖的版本有关。。。。
该报错的核心在于你的 SQL 查询语句的写法 与你使用的 MySQL 版本默认的严格模式 不兼容
下面是我的解决方案
1 2 3 4 5 6 7 8 9 10 11
<select id="getTotalByDate" resultType="com.xq.tmall.entity.OrderGroup"> SELECT MIN(productOrder_pay_date) AS productOrder_pay_date, count(productOrder_id) as productOrder_count, productOrder_status FROM productOrder <where> productOrder_pay_date BETWEEN #{beginDate} AND #{endDate} </where> GROUP BY DATE_FORMAT(productOrder_pay_date,'%Y-%m-%d'), productOrder_status </select>