2 title: injectConverters
3 date: 2019-09-27T18:51:08+02:00
12 - dependency injection
15 Toggles whether converters are exposed as constructor parameters and created by `YoSQL` using the default constructor of a converter. Defaults to `false`.
17 ## Configuration Options
21 The default value of the `injectConverters` configuration option is `false`. Setting the option to `false` therefore produces the same code generated as the default configuration without any configuration option set. It produces code similar to this:
24 package com.example.persistence;
26 public class SomeRepository {
28 private final DataSource dataSource;
30 private final ToResultRowConverter resultRow;
32 public SomeRepository(final DataSource dataSource) {
33 this.dataSource = dataSource;
34 this.resultRow = new ToResultRowConverter();
37 // ... rest of generated code
44 Changing the `injectConverters` configuration option to `true` generates the following code instead:
47 package your.own.domain;
49 public class SomeRepository {
51 private final DataSource dataSource;
53 private final ToResultRowConverter resultRow;
55 public SomeRepository(final DataSource dataSource, final ToResultRowConverter resultRow) {
56 this.dataSource = dataSource;
57 this.resultRow = resultRow;
60 // ... rest of generated code
67 - [allowedCallPrefixes](../allowedcallprefixes/): Controls which method name prefixes are allowed for calling statements.
68 - [allowedReadPrefixes](../allowedreadprefixes/): Controls which method name prefixes are allowed for reading statements.
69 - [allowedWritePrefixes](../allowedwriteprefixes/): Controls which method name prefixes are allowed for writing statements.
70 - [basePackageName](../basepackagename/): Controls the base package name for generated repositories.
71 - [validateMethodNamePrefixes](../validatemethodnameprefixes/): Controls whether method name prefixes are validated.
77 In order to use `YoSQL` together with [Maven](https://maven.apache.org/), take a look at the tooling [documentation for Maven](/tooling/maven/).
79 {{< maven/config/repositories/injectConverters >}}
83 In order to use `YoSQL` together with [Gradle](https://gradle.org/), take a look at the tooling [documentation for Gradle](/tooling/gradle/).
88 id("wtf.metio.yosql") version "2021.4.21"
93 injectConverters.set(true)
101 id "wtf.metio.yosql" version "2021.4.21"
106 injectConverters = true
113 In order to use `YoSQL` together with [Bazel](https://bazel.build/), take a look at the tooling [documentation for Bazel](/tooling/bazel/).
117 In order to use YoSQL on the command line, take a look at the tooling [documentation for CLI](/tooling/cli/).
120 $ yosql --repositories-inject-converters=true
123 The shorter form is available as well:
126 $ yosql --inject-converters=true