Skip to content

Commit

Permalink
Change property name to disableDataSourceProvider, check MP config an…
Browse files Browse the repository at this point in the history
…d sys props
  • Loading branch information
barchetta committed Dec 23, 2024
1 parent f47f42f commit 0691090
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class JaxRsService implements HttpService {
* If set to {@code "true"}, Jersey will ignore responses in exceptions.
*/
static final String IGNORE_EXCEPTION_RESPONSE = "jersey.config.client.ignoreExceptionResponse";
static final String SUPPRESS_DATASOURCE_PROVIDER = "jersey.config.server.suppressDataSourceProvider";
static final String DISABLE_DATASOURCE_PROVIDER = "jersey.config.server.disableDataSourceProvider";

private static final System.Logger LOGGER = System.getLogger(JaxRsService.class.getName());
private static final Type REQUEST_TYPE = (new GenericType<Ref<ServerRequest>>() { }).getType();
Expand All @@ -98,9 +98,14 @@ private JaxRsService(ResourceConfig resourceConfig,

static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injectionManager) {

// Silence warnings from Jersey. See 9019. Allow overriding to pass tck
boolean suppressDatasourceProvider = Boolean.parseBoolean(System.getProperty(SUPPRESS_DATASOURCE_PROVIDER, "true"));
if (!resourceConfig.hasProperty(CommonProperties.PROVIDER_DEFAULT_DISABLE) && suppressDatasourceProvider) {
Config config = ConfigProvider.getConfig();

// Silence warnings from Jersey by disabling the default data source provider. See 9019.
// To pass TCK we support a system property to control whether or not we disable the default provider
// We also support the property via MicroProfile config in case a user wants to control the property.
boolean disableDatasourceProvider = config.getOptionalValue(DISABLE_DATASOURCE_PROVIDER, Boolean.class)
.orElseGet(() -> Boolean.parseBoolean(System.getProperty(DISABLE_DATASOURCE_PROVIDER, "true")));
if (!resourceConfig.hasProperty(CommonProperties.PROVIDER_DEFAULT_DISABLE) && disableDatasourceProvider) {
resourceConfig.addProperties(Map.of(CommonProperties.PROVIDER_DEFAULT_DISABLE, "DATASOURCE"));
}
if (!resourceConfig.hasProperty(ServerProperties.WADL_FEATURE_DISABLE)) {
Expand All @@ -112,7 +117,6 @@ static JaxRsService create(ResourceConfig resourceConfig, InjectionManager injec
new WebServerBinder(),
ij);
Container container = new HelidonJerseyContainer(appHandler);
Config config = ConfigProvider.getConfig();

// This configuration via system properties is for the Jersey Client API. Any
// response in an exception will be mapped to an empty one to prevent data leaks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
<webServerHost>localhost</webServerHost>
<webServerPort>8080</webServerPort>
<jersey.config.client.ignoreExceptionResponse>false</jersey.config.client.ignoreExceptionResponse>
<jersey.config.server.suppressDataSourceProvider>false</jersey.config.server.suppressDataSourceProvider>
<jersey.config.server.disableDataSourceProvider>false</jersey.config.server.disableDataSourceProvider>
<jersey.config.allowSystemPropertiesProvider>true</jersey.config.allowSystemPropertiesProvider>
<org.jboss.weld.bootstrap.concurrentDeployment>false</org.jboss.weld.bootstrap.concurrentDeployment>
<org.jboss.weld.construction.relaxed>false</org.jboss.weld.construction.relaxed>
Expand Down

0 comments on commit 0691090

Please sign in to comment.