我正在尝试将项目从SpringBoot迁移到Quarkus。
当前模块中的deps看起来像这样(加上一些vertx deps):
plugins {
id 'io.quarkus'
id 'org.kordamp.gradle.jandex' version '0.7.0'
}
dependencies {
compile 'io.quarkus:quarkus-vertx'
compile 'io.quarkus:quarkus-vertx-web'
compile enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
compile "io.quarkus:quarkus-spring-boot-properties:${quarkusPlatformVersion}"
compile 'io.quarkus:quarkus-spring-di'
compile 'io.quarkus:quarkus-spring-web'
implementation ("org.springframework.boot:spring-boot-starter-aop")
implementation ("org.springframework.boot:spring-boot-starter-webflux")
}
据我了解,不需要替换spring注释(@SpringBootApplication除外)。
其他测试项目运行正常,但在这种情况下,quarkusDev任务失败并显示错误:
2020-10-15 18:56:26,745 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: Found 15 deployment problems:
[1] Unsatisfied dependency for type com./.../.service.autoconfigure.MyProperties and qualifiers [@Default]
- java member: com./.../.http.tracing.MyService#<init>()
- declared on CLASS bean [types=[com./.../.http.tracing.MyService, java.lang.Object], qualifiers=[@Default, @Any], target=com./.../.http.tracing.MyService]
以此类推。一些失败的原因来自相邻模块,其他的则来自外部库。 目前,我不知道是什么原因导致了此错误。
我的属性:
package com./.../.core.service.autoconfigure;
import lombok.Data;
import lombok.ToString;
import org.springframework.boot.context.properties.ConfigurationProperties;
import java.util.HashMap;
import java.util.Map;
@Data
@ConfigurationProperties("grpc.client")
@ToString
public class MyProperties {
private boolean abortOnCallCancel = false;
private Map<String, ClientSettings> settings = new HashMap<>();
private Long dynamicChannelCacheSize = 1000L;
public ClientSettings getDefaultSettings() {
return settings.get(ClientSettings.DEFAULT_KEY);
}
@Data
public static class ClientSettings {
public static final String DEFAULT_KEY = "default";
private String hostname;
private int port;
private Long timeout;
private Map<String, Object> serviceConfig = new HashMap<>();
}
}