这是 JDK 11 的当前 Github,运行良好。我已将我的项目迁移到 JDK 17。它在本地运行良好,但会破坏 Github 工作流程。我不知道该如何解决?
.github\workflows\docker-publish.yml:-
name: Docker
on:
push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ master ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
TAG: 'latest'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs. …Run Code Online (Sandbox Code Playgroud) 的IntelliJ格式当我使用完整的文件Ctl+ Atl+L从菜单代码- >重新格式化代码。这会在 git commit 中生成整个差异。我只想格式化我更改过的代码而不是整个文件。我该怎么做?
我按照这个https://sdkman.io/install来安装 sdkman。滴注后一切都很好。我可以通过sdk版本看到正确的版本。我还可以安装各种Java版本。但一切都是为了正确的 shell 会话。一旦我关闭并打开新的 shell,我既无法获取 sdkman,也无法获取已安装的 JDK。我可以在 上看到所有 JDK ~/.sdkman/candidates/java。我必须一直运行这个source "$HOME/.sdkman/bin/sdkman-init.sh"
如何在我的系统中永久设置 sdkman 和 JDK。
Spring boot 2.5.4 我第一次在我的服务类中使用@PostConstruct。如下:-
@Slf4j
@Service
@AllArgsConstructor
public class FileMonitorService {
private final AppProperties appProperties;
private final WatchService watchService;
private final RestTemplate restTemplate;
@PostConstruct
@Async
public void startMonitoring() {
FileUtils.setAppProperties(appProperties);
FileUtils.setRestTemplate(restTemplate);
FileUtils.readFilesForDirectory();
log.info("START_MONITORING");
try {
WatchKey key;
while ((key = watchService.take()) != null) {
for (WatchEvent<?> event : key.pollEvents()) {
log.info("Event kind: {}; File affected: {}", event.kind(), event.context());
if((event.kind() == StandardWatchEventKinds.ENTRY_CREATE ||
event.kind() == StandardWatchEventKinds.ENTRY_MODIFY) &&
event.context().toString().contains(".xml")){
try {
restTemplateRequest(event.context().toString()+" processing");
FileUtils.readXml(Path.of(FileUtils.getFileAbsolutePath(appProperties.getDataIn()),
event.context().toString()));
}catch (Exception e){
log.error("startMonitoring Exception: "+e.getMessage());
} …Run Code Online (Sandbox Code Playgroud) 这是我的第二个清单,其中包含超过数百万个项目。两者都有相同 ID 的相同项目。ID 位于字符串中。我只需要ID不同的项目。我就是这样做的。但我确信一定有一个更好且持久的解决方案:-
List<Transaction> differentList = new ArrayList<>();
for(Transaction tx : foundTransactions ){
for(Transaction aTx : ArchivedTransactions)
{
if(!tx.getId().equalsIgnoreCase(aTx.getId()) ){
differentList .add(tx);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用流,但我做不到。我想使用stream API应该会更好。请建议我任何改进。