Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure various non-bean JAX-RS components work in native #19201

Merged
merged 1 commit into from
Aug 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.quarkus.arc.processor.DotNames;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.resteasy.reactive.common.deployment.ResourceScanningResultBuildItem;
import io.quarkus.resteasy.reactive.server.runtime.QuarkusContextProducers;
import io.quarkus.resteasy.reactive.spi.DynamicFeatureBuildItem;
Expand Down Expand Up @@ -84,18 +85,25 @@ void pathInterfaceImpls(Optional<ResourceScanningResultBuildItem> resourceScanni

@BuildStep
void additionalBeans(List<DynamicFeatureBuildItem> additionalDynamicFeatures,
BuildProducer<ReflectiveClassBuildItem> reflectiveClassBuildItemBuildProducer,
List<JaxrsFeatureBuildItem> featureBuildItems,
BuildProducer<AdditionalBeanBuildItem> additionalBean) {

AdditionalBeanBuildItem.Builder additionalProviders = AdditionalBeanBuildItem.builder();
for (DynamicFeatureBuildItem dynamicFeature : additionalDynamicFeatures) {
if (dynamicFeature.isRegisterAsBean()) {
additionalProviders.addBeanClass(dynamicFeature.getClassName());
} else {
reflectiveClassBuildItemBuildProducer
.produce(new ReflectiveClassBuildItem(true, false, false, dynamicFeature.getClassName()));
}
}
for (JaxrsFeatureBuildItem dynamicFeature : featureBuildItems) {
if (dynamicFeature.isRegisterAsBean()) {
additionalProviders.addBeanClass(dynamicFeature.getClassName());
for (JaxrsFeatureBuildItem feature : featureBuildItems) {
if (feature.isRegisterAsBean()) {
additionalProviders.addBeanClass(feature.getClassName());
} else {
reflectiveClassBuildItemBuildProducer
.produce(new ReflectiveClassBuildItem(true, false, false, feature.getClassName()));
}
}
additionalBean.produce(additionalProviders.setUnremovable().setDefaultScope(DotNames.SINGLETON).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.index.IndexingUtil;
import io.quarkus.resteasy.reactive.common.deployment.ApplicationResultBuildItem;
import io.quarkus.resteasy.reactive.common.deployment.ResourceInterceptorsContributorBuildItem;
Expand Down Expand Up @@ -99,6 +100,7 @@ public void accept(ResourceInterceptors interceptors) {
public ExceptionMappersBuildItem scanForExceptionMappers(CombinedIndexBuildItem combinedIndexBuildItem,
ApplicationResultBuildItem applicationResultBuildItem,
BuildProducer<AdditionalBeanBuildItem> additionalBeanBuildItemBuildProducer,
BuildProducer<ReflectiveClassBuildItem> reflectiveClassBuildItemBuildProducer,
List<ExceptionMapperBuildItem> mappers, Capabilities capabilities) {
AdditionalBeanBuildItem.Builder beanBuilder = AdditionalBeanBuildItem.builder().setUnremovable();
ExceptionMapping exceptions = ResteasyReactiveExceptionMappingScanner
Expand All @@ -118,6 +120,9 @@ public ExceptionMappersBuildItem scanForExceptionMappers(CombinedIndexBuildItem
for (ExceptionMapperBuildItem additionalExceptionMapper : mappers) {
if (additionalExceptionMapper.isRegisterAsBean()) {
beanBuilder.addBeanClass(additionalExceptionMapper.getClassName());
} else {
reflectiveClassBuildItemBuildProducer
.produce(new ReflectiveClassBuildItem(true, false, false, additionalExceptionMapper.getClassName()));
}
int priority = Priorities.USER;
if (additionalExceptionMapper.getPriority() != null) {
Expand All @@ -141,6 +146,7 @@ public ExceptionMappersBuildItem scanForExceptionMappers(CombinedIndexBuildItem
@BuildStep
public ParamConverterProvidersBuildItem scanForParamConverters(CombinedIndexBuildItem combinedIndexBuildItem,
BuildProducer<AdditionalBeanBuildItem> additionalBeanBuildItemBuildProducer,
BuildProducer<ReflectiveClassBuildItem> reflectiveClassBuildItemBuildProducer,
ApplicationResultBuildItem applicationResultBuildItem,
List<ParamConverterBuildItem> paramConverterBuildItems) {

Expand All @@ -153,6 +159,9 @@ public ParamConverterProvidersBuildItem scanForParamConverters(CombinedIndexBuil
for (ParamConverterBuildItem additionalParamConverter : paramConverterBuildItems) {
if (additionalParamConverter.isRegisterAsBean()) {
beanBuilder.addBeanClass(additionalParamConverter.getClassName());
} else {
reflectiveClassBuildItemBuildProducer
.produce(new ReflectiveClassBuildItem(true, false, false, additionalParamConverter.getClassName()));
}
int priority = Priorities.USER;
if (additionalParamConverter.getPriority() != null) {
Expand Down Expand Up @@ -197,6 +206,7 @@ public void scanForFeatures(CombinedIndexBuildItem combinedIndexBuildItem,
public ContextResolversBuildItem scanForContextResolvers(CombinedIndexBuildItem combinedIndexBuildItem,
ApplicationResultBuildItem applicationResultBuildItem,
BuildProducer<AdditionalBeanBuildItem> additionalBeanBuildItemBuildProducer,
BuildProducer<ReflectiveClassBuildItem> reflectiveClassBuildItemBuildProducer,
List<ContextResolverBuildItem> additionalResolvers) {
IndexView index = combinedIndexBuildItem.getComputingIndex();
AdditionalBeanBuildItem.Builder beanBuilder = AdditionalBeanBuildItem.builder().setUnremovable();
Expand All @@ -210,6 +220,9 @@ public ContextResolversBuildItem scanForContextResolvers(CombinedIndexBuildItem
for (ContextResolverBuildItem i : additionalResolvers) {
if (i.isRegisterAsBean()) {
beanBuilder.addBeanClass(i.getClassName());
} else {
reflectiveClassBuildItemBuildProducer
.produce(new ReflectiveClassBuildItem(true, false, false, i.getClassName()));
}
ResourceContextResolver resolver = new ResourceContextResolver();
resolver.setClassName(i.getClassName());
Expand Down