我想将一个项目从 spring boot 2.2.7 迁移到 spring boot 3.0.0。为此,我使用 spring starter 生成了一个新项目,除了生成的项目之外,我还添加了一些依赖项:
完整的pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.0.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.app</groupId>
<artifactId>chronos</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>chronos</name>
<description>Chronos booking system</description>
<properties>
<java.version>17</java.version>
<org.mapstruct.version>1.5.3.Final</org.mapstruct.version>
<lombok.version>1.18.24</lombok.version>
<version.hibernate-jpamodelgen>6.1.5.Final</version.hibernate-jpamodelgen>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>org.liquibase</groupId> …
Run Code Online (Sandbox Code Playgroud) 我试图从 SAP 系统读取表,但总是收到此错误:
Exception in thread "main" com.sap.conn.jco.JCoRuntimeException: (127)
JCO_ERROR_FIELD_NOT_FOUND: Field EMPLOYEE is not a member of INPUT
at com.sap.conn.jco.rt.AbstractMetaData.indexOf(AbstractMetaData.java:404)
at com.sap.conn.jco.rt.AbstractRecord.setValue(AbstractRecord.java:4074)
at testConf.StepServer.main(StepServer.java:50)
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
public static void main(String[] args) {
// This will create a file called mySAPSystem.jcoDestination
System.out.println("executing");
String DESTINATION_NAME1 = "mySAPSystem";
Properties connectProperties = new Properties();
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "xxx.xxx.x.xxx");
connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "xx");
connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "xxx");
connectProperties.setProperty(DestinationDataProvider.JCO_USER, "username");
connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "test");
connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");
createDestinationDataFile(DESTINATION_NAME1, connectProperties);
// This will use that destination file to connect to SAP
try {
JCoDestination destination = JCoDestinationManager.getDestination("mySAPSystem"); …
Run Code Online (Sandbox Code Playgroud) 我MessageDialog
在QML中遇到信号问题。在我的MessageDialog
我有两个按钮是和否。我想用信号连接每个按钮。这是我的qml文件:
import QtQuick 2.2
import QtQuick.Dialogs 1.1
Item{
MessageDialog {
signal qmlYesSig(string msg)
signal qmlNoSig (string msg)
title: "Send data?"
icon: StandardIcon.Question
text: "Do you want to save your data on the online platform?"
detailedText: "Click Yes "
standardButtons: StandardButton.Yes | StandardButton.No
Component.onCompleted: visible = true
onYes: qmlYesSig("From yes")
onNo: qmlNoSig("From no")
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的广告位:
class MyClass : public QObject
{
Q_OBJECT
public slots:
void cppSlot(const QString &msg) {
qDebug() << "Called …
Run Code Online (Sandbox Code Playgroud) 我试图了解多个 catch 语句在 Java 中的工作原理。在文档中,他们说不允许在 catch 语句中使用相关类型。
在这里,我有一个我正在玩的小样本:
class a extends Exception{}
class b extends RuntimeException{}
public class test{
public static void main(String[] args){
try {
System.out.println(new a() instanceof Exception);
System.out.println(new b() instanceof Exception);
throw new a();
}catch(a | b e) {
System.out.println(e.getStackTrace());
}
}
}
Run Code Online (Sandbox Code Playgroud)
这两个类都是 Exception 的实例。首先,一个是明显的方式,第二个继承自 RuntimeException 和 RuntimeExeption 继承 Exception。
那么为什么要编译这段代码呢?不应该例外a盖也例外b?谢谢
我有一个奇怪的日期格式(例如 3.4.2021 -> dMyyyy 零被跳过),我想得到一个格式为 dd.MM.yyyy 的字符串,但我到目前为止尝试的所有内容都抛出异常并说文本不能解析。
我尝试过的示例之一:
String d = LocalDate.parse(startDatePannel).format(DateTimeFormatter.ofPattern("d.M.yyyy"));
Run Code Online (Sandbox Code Playgroud)
我怎样才能解析这个日期?