Skip to content

Commit

Permalink
Merge pull request #32005 from michalvavrik/feature/hibernate-dev-mod…
Browse files Browse the repository at this point in the history
…e-dont-depend-on-profile

Hibernate ORM and Search DEV bean should be available in DEV launch mode
  • Loading branch information
yrodiere authored Mar 21, 2023
2 parents 8099f14 + d9a8dde commit 9e7ac75
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.List;

import io.quarkus.agroal.spi.JdbcInitialSQLGeneratorBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.processor.DotNames;
import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
Expand Down Expand Up @@ -47,6 +49,16 @@ JsonRPCProvidersBuildItem createJsonRPCService() {
return new JsonRPCProvidersBuildItem(NAME, HibernateOrmDevJsonRpcService.class);
}

@BuildStep
AdditionalBeanBuildItem additionalBeans() {
return AdditionalBeanBuildItem
.builder()
.addBeanClass(HibernateOrmDevJsonRpcService.class)
.setUnremovable()
.setDefaultScope(DotNames.APPLICATION_SCOPED)
.build();
}

@BuildStep
void handleInitialSql(List<PersistenceUnitDescriptorBuildItem> persistenceUnitDescriptorBuildItems,
BuildProducer<JdbcInitialSQLGeneratorBuildItem> initialSQLGeneratorBuildItemBuildProducer) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
package io.quarkus.hibernate.orm.runtime.dev;

import jakarta.enterprise.context.ApplicationScoped;

import io.quarkus.arc.profile.IfBuildProfile;

@ApplicationScoped
@IfBuildProfile("dev")
public class HibernateOrmDevJsonRpcService {

public HibernateOrmDevInfo getInfo() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import java.util.Set;
import java.util.stream.Collectors;

import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.processor.DotNames;
import io.quarkus.deployment.IsDevelopment;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.BuildSteps;
Expand Down Expand Up @@ -43,6 +45,16 @@ public CardPageBuildItem create(HibernateSearchElasticsearchDevRecorder recorder
return card;
}

@BuildStep
AdditionalBeanBuildItem additionalBeans() {
return AdditionalBeanBuildItem
.builder()
.addBeanClass(HibernateSearchElasticsearchDevJsonRpcService.class)
.setUnremovable()
.setDefaultScope(DotNames.APPLICATION_SCOPED)
.build();
}

@BuildStep
JsonRPCProvidersBuildItem createJsonRPCService() {
return new JsonRPCProvidersBuildItem(NAME, HibernateSearchElasticsearchDevJsonRpcService.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@

import java.util.List;

import jakarta.enterprise.context.ApplicationScoped;

import org.hibernate.search.mapper.orm.mapping.SearchMapping;

import io.quarkus.arc.profile.IfBuildProfile;
import io.smallrye.mutiny.Multi;

@ApplicationScoped
@IfBuildProfile("dev")
public class HibernateSearchElasticsearchDevJsonRpcService {

public HibernateSearchElasticsearchDevInfo getInfo() {
Expand Down

0 comments on commit 9e7ac75

Please sign in to comment.