开发工具分享
  • 首页
  • 计算科学
  • 文化旅游
  • 项目和网站
    • OSSEZ 计算技术
    • USRealEstate 社区
    • 地区文化
    • CWIKI.US
    • BUG.OSSEZ.COM
    • RSS.OSSEZ.COM
CWIKIUS.CN
一个有独立思考和温度的清新站
Computer Science

Spring Batch 源代码进行编译的时候提示仓库错误

在对 Spring Batch 源代码进行编译的时候,提示仓库配置错误错误: org.gradle.api.resources.ResourceException: Could not get resource 'http://repo.spring.io/plugins-release/org/springframework/build/gradle/propdeps-plugin/0.0.7/propdeps-plugin-0.0.7.pom'.     根据官方的提示下面的这篇文章:https://spring.io/blog/2020/10/29/notice-of-permissions-changes-to-repo-spring-io-fall-and-winter-2020 在默认匿名用户访问的情况下,Spring Boot 的仓库有所调整。 针对 maven { url 'https://repo.spring.io/plugins-release' } 这个仓库地址,需要使用: maven { url 'https://repo.spring.io/plugins-release-local' } 来进行替代,以避免授权的问题。     完成上面的修改后,再重新编译就可以避免仓库地址的授权问题了。 https://www.ossez.com/t/spring-batch/776

2020年12月21日 0Comments 608Browse 0Like Read more
Computer Science

Git 在 Windows 克隆的时候提示错误 Filename too long

从 GitHub 克隆一个项目下发出现了错误: error: unable to create file spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/resources/org/springframework/boot/gradle/plugin/JavaPluginActionIntegrationTests-javaCompileTasksCanOverrideDefaultParametersCompilerFlag.gradle: Filename too long     Git 可以创建 4096 长度的文件名,然而在 windows 最多是260。 因此有时候在项目中你可能会遇到文件名过长的问题。 可以执行下面的命令进行全局修改: git config --global core.longpaths true     然后再次执行克隆,就可以避免这个长文件名的问题了。 https://www.ossez.com/t/git-windows-filename-too-long/775

2020年12月20日 0Comments 799Browse 0Like Read more
Computer Science

IntelliJ IDEA Java 代码注释格式化

在默认的情况下,当你点击进去到代码中,IntelliJ IDEA 将会自动将问答转换为可读的模式。 当你单击左侧的笔的图标后,将会在编辑器中显示格式化之前的文档。     这个应该算是 IJ 的一个新功能,因为在以前的版本是不会这样做的,能够降低代码的阅读量。 https://www.ossez.com/t/intellij-idea-java/774

2020年12月20日 0Comments 1088Browse 0Like Read more
Computer Science

Spring RestController @RequestParam 中的 required=false 参数

这个参数是 required 确定在 API 中的参数中是否必须要输出参数。 在默认情况下为 true,你可以设置这个参数为 false。 如果你设置的参数为 true,但是在提交参数的时候没有提交这个参数,你的 API 将会返回一个异常。 考察下面的代码: @GetMapping("/search") public ResponseEntity<?> searchTestBank(@RequestParam String id) { } 在上面的代码中,我们不指定了返回。 上面参数的定义是要求参数不为 null,如果你输入 null 的参数的话,你会在 API 看到下面的错误。 { "timestamp": 1608394372349, "status": 400, "error": "Bad Request", "message": "", "path": "/testbank/search" } 在上面的访问的时候提示了 Bad Request 错误,这是因为没有为发送参数到 API 中。 如果你修改代码为: @GetMapping("/search") public ResponseEntity<?> searchTestBank(@RequestParam(required=false) String id) { } 就可以避免这个问题了。     这个是 Spring Boot 的一个参数配置,可以根据实际情况进行配置。 https://www.ossez.com/t/spring-restcontroller-requestparam-required-false/773

2020年12月20日 0Comments 635Browse 0Like Read more
文化旅游

为什么飞机需要数客,而高铁不用

飞机上的规定都是血的教训来的规定的。 确定所有旅客上飞机的最大考虑就是安全了。目前航空公司规定的是行李和人须同时上飞机,当然也不绝对是这样的,有时候行李丢了,或者行李延误了,人走了,行李没走也是有可能的。具体航空公司怎么处理这个问题,不太清楚。 绝大部分情况下是人和行李需要同时上飞机,如果人已经过了安检了,机场是知道你过了安检的,这个时候行李就已经开始准备装飞机了。 还有个说法是飞机配重,貌似不是主要原因。 如果在你登机结束了,你还不在登机口,航空公司会去找你。主要原因是,如果你不上飞机,航空公司要把你行李找出来,然后从飞机上卸下来。同时因为你延误,航空公司还要安排下一班飞机让你走,有些公司可能要收费,或者要你重新买票,有些公司可能会直接送走你。 不管怎么样,对航空公司都是成本,所以航空公司会对过了安检或者准备安检的乘客在登机快结束之前进行广广播找你,在这里多花几分钟能避免不少问题和成本。如果你还没有过办票,行李没有交运的话,基本上不会找你。 换国际航班,这里成本更高,为了方便自己也方便别人,还是早点到机场吧,过了安检周边转转,别到处瞎跑就好了。 https://www.ossez.com/t/topic/772

2020年12月18日 0Comments 971Browse 0Like Read more
Computer Science

同学要抄我的代码,该给他吗

如果就题目来说,明显是抄的话,肯定不能给,这个涉及到学术诚信问题。在美国大学只要涉及到学术诚信问题,基本上是一票否决,提供代码的和使用的人都会一并处理。 从实际上来说,其实大学学的那些算法和数据结构在具体的项目中用处真的不大,如果一个人用心花几周,基本上数据结构大学那些东西也能啃下得差不多,估计更多是题主担心自己的工作成果被无偿占用了。 其实也不是没有办法呀,GitHub 就很好呀,你的代码肯定要部署到一个地方,Git 呗,上面有推送记录,提交记录,你的修改记录,能够很好的证明这个是你的原创,如果你觉得面子上过不去,给个 Git 的仓库给他看看,然后说说这是 Team Work 啥的,就算找麻烦也找不到你。代码这东西,每一个人有每一个人的写法,定义不一样,有些人喜欢用 IF,甚至连方法命名都不一样,有些人喜欢用 int,有些人喜欢用 long,其实都是殊途同归。 保持一种开放心态吧,这种东西真的没有那么重要,开源世界不都是这样的吗? https://www.ossez.com/t/topic/771

2020年12月18日 0Comments 765Browse 0Like Read more
Computer Science

Java 如何做到将Excel里的数据导入到MySQL中

有好几个办法可以做。 将数据转换为 CSV, 用处理 csv 来处理。 还有一个就是 Apache poi,请参考文章:Apache POI 读取 Microsoft Office Excel 文档 将数据先读到内存里面,然后用 hibernate 写个 ORM,或者你就处理文本,直接输出 SQL 呗。 将数据先读到内存里面是关键。   https://www.ossez.com/t/java-excel-mysql/770

2020年12月18日 0Comments 745Browse 1Like Read more
Computer Science

为什么编程中大家都喜欢使用int来代表各种状态和类型常量

用int 效率高,便于转换,便于国际化。 不管怎么样使用中文也好英文也罢,字符占用存储比 int 要多,中文更多了。int 数据库好索引,查询快。 国际化 字符 map 方便。 另外这个是大家都懂的定义,提高代码可读性。要知道你的代码有时候也是要给别人读的。有时候可能看起来不太好的,但是也都是习惯了,更多的惯例就是规定。 https://www.ossez.com/t/int/769  

2020年12月18日 0Comments 819Browse 0Like Read more
Computer Science

Spring Boot API 中文字符乱码

Spring Boot 在运行 API 的时候如果返回数据库的时候提示中文是乱码。 但是针对不同的浏览器,返回的结果是不一样的。 在 Application.yml 中 添加下面的配置: server: servlet: encoding: force: true charset: UTF-8 enabled: true     然后重新启动服务器后,我们所有的访问都会使用 UTF-8 编码。 这样以避免字符集错误。     需要注意的是,不同的浏览器对字符集的编码是不一样的,最好都测一下。 针对手机平台也是不一样的。 https://www.ossez.com/t/spring-boot-api/768

2020年12月14日 0Comments 776Browse 0Like Read more
Computer Science

Logstash-logback-encoder 和 logback 出现错误

获得的错误信息为: Exception in thread "main" java.lang.IllegalStateException: Logback configuration error detected: ERROR in ch.qos.logback.core.joran.util.PropertySetter@34237b90 - A "net.logstash.logback.encoder.LogstashEncoder" object is not assignable to a "ch.qos.logback.core.Appender" variable. ERROR in ch.qos.logback.core.joran.util.PropertySetter@34237b90 - The class "ch.qos.logback.core.Appender" was loaded by ERROR in ch.qos.logback.core.joran.util.PropertySetter@34237b90 - [jdk.internal.loader.ClassLoaders$AppClassLoader@16f65612] whereas object of type ERROR in ch.qos.logback.core.joran.util.PropertySetter@34237b90 - "net.logstash.logback.encoder.LogstashEncoder" was loaded by [jdk.internal.loader.ClassLoaders$AppClassLoader@16f65612]. at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169) at org.springframework.boot.logging.logback.LogbackLoggingSystem.reinitialize(LogbackLoggingSystem.java:222) at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:73) at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:60) at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:118) at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:306) at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:281) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:239) at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:216) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127) at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:80) at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53) at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:345) at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) at com.ossez.edtestbank.service.Application.main(Application.java:44) 问题和解决 这个是包的兼容性问题。 logback-core 需要设置为 1.2.0 版本,如果你设置了更高的版本的话,你就会遇到上面的问题。 请参考下面链接中的问题: https://jira.qos.ch/browse/LOGBACK-1326 貌似到现在还没有解决。     如果你还希望使用 logstash-logback-encoder 的话,那么需要将 logback 设置为 1.2.0 版本。 https://www.ossez.com/t/logstash-logback-encoder-logback/767

2020年12月14日 0Comments 2639Browse 5Like Read more
12345
Archives
  • June 2026
  • May 2026
  • April 2026
  • March 2026
  • February 2026
  • January 2026
  • December 2025
  • November 2025
  • October 2025
  • September 2025
  • August 2025
  • July 2025
  • June 2025
  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
Categories
  • Computer Science (2,367)
    • Confluence (663)
    • Gradle (12)
  • U.S. (511)
  • 文化旅游 (146)

COPYRIGHT © 2020 CWIKIUS. ALL RIGHTS RESERVED.

THEME KRATOS MADE BY VTROIS

湘ICP备2020018253号-1