Quarkus, profile at bean / class level

Viewed 97

I would like to initialize the class based on the profile. I have mock service for development and prod has real implementation.

public interface Service {
} 

For dev:

//@Profile("Dev") -- not supported in quarkus
@ApplicationScoped
public MockService implements Service {
}

For Prod

//@Profile("prod") -- not supported in quarkus
@ApplicationScoped
public MainService implements Service {
}

Is it possible with quarkus? is there any work around?

1 Answers

Check out this part of the documentation.

Your example would likely look like:

@IfBuildProfile("dev")
@ApplicationScoped
public MockService implements Service {

}

@DefaultBean
@ApplicationScoped
public MainService implements Service {
}
Related