Skip to content

Commit

Permalink
'3.2.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
jknack committed Jul 16, 2024
1 parent 53380ae commit b698790
Show file tree
Hide file tree
Showing 36 changed files with 1,954 additions and 1,804 deletions.
2,103 changes: 1,109 additions & 994 deletions index.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions migration/3.x/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -635,13 +635,13 @@ <h4 id="upgrading-from-2-x-to-3-x-kotlin"><a class="anchor" href="#upgrading-fro


<div class="switch"><div class="switch--item option-1 selected">Maven</div><div class="switch--item option-2">Gradle</div></div><div class="content option-1">
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml" id="x61381ee2720f4e11">&lt;dependency&gt;
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml" id="x8128227d7fa44b33">&lt;dependency&gt;
&lt;groupId&gt;io.jooby&lt;/groupId&gt;
&lt;artifactId&gt;jooby-kotlin&lt;/artifactId&gt;
&lt;version&gt;3.2.3&lt;/version&gt;
&lt;/dependency&gt;</code><button class="clipboard" data-clipboard-target="#x61381ee2720f4e11"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
&lt;version&gt;3.2.5&lt;/version&gt;
&lt;/dependency&gt;</code><button class="clipboard" data-clipboard-target="#x8128227d7fa44b33"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div><div class="content hidden option-2">
<pre class="highlightjs highlight"><code class="language-gradle hljs" data-lang="gradle" id="xa27025c6de0948e2">implementation 'io.jooby:jooby-kotlin:3.2.3'</code><button class="clipboard" data-clipboard-target="#xa27025c6de0948e2"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
<pre class="highlightjs highlight"><code class="language-gradle hljs" data-lang="gradle" id="xa3542e7cb89b46c5">implementation 'io.jooby:jooby-kotlin:3.2.5'</code><button class="clipboard" data-clipboard-target="#xa3542e7cb89b46c5"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div></div>

</div>
Expand Down
77 changes: 56 additions & 21 deletions modules/avaje-inject/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -588,23 +588,58 @@ <h3 id="avaje-inject"><a class="anchor" href="#avaje-inject"></a><a class="link"


<div class="switch"><div class="switch--item option-1 selected">Maven</div><div class="switch--item option-2">Gradle</div></div><div class="content option-1">
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml" id="xee764430d6904056">&lt;dependency&gt;
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml" id="x6836b9f54cb64920">&lt;dependency&gt;
&lt;groupId&gt;io.jooby&lt;/groupId&gt;
&lt;artifactId&gt;jooby-avaje-inject&lt;/artifactId&gt;
&lt;version&gt;1.1.0&lt;/version&gt;
&lt;/dependency&gt;</code><button class="clipboard" data-clipboard-target="#xee764430d6904056"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
&lt;/dependency&gt;</code><button class="clipboard" data-clipboard-target="#x6836b9f54cb64920"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div><div class="content hidden option-2">
<pre class="highlightjs highlight"><code class="language-gradle hljs" data-lang="gradle" id="xfe27fe9caee64494">implementation 'io.jooby:jooby-avaje-inject:1.1.0'</code><button class="clipboard" data-clipboard-target="#xfe27fe9caee64494"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
<pre class="highlightjs highlight"><code class="language-gradle hljs" data-lang="gradle" id="x459d58792c954c17">implementation 'io.jooby:jooby-avaje-inject:1.1.0'</code><button class="clipboard" data-clipboard-target="#x459d58792c954c17"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div></div>

<div class="paragraph">
<p>2) Install Avaje Inject:</p>
<p>2) Configure annotation processor</p>
</div>
<div class="listingblock primary">


<div class="switch"><div class="switch--item option-1 selected">Maven</div><div class="switch--item option-2">Gradle</div></div><div class="content option-1">
<pre class="highlightjs highlight"><code class="language-xml hljs" data-lang="xml" id="x25cf7706288f4d51">&lt;build&gt;
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
&lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
&lt;version&gt;...&lt;/version&gt;
&lt;configuration&gt;
&lt;annotationProcessorPaths&gt;
&lt;path&gt;
&lt;groupId&gt;io.avaje&lt;/groupId&gt;
&lt;artifactId&gt;avaje-inject-generator&lt;/artifactId&gt;
&lt;version&gt;10.0&lt;/version&gt;
&lt;/path&gt;
&lt;/annotationProcessorPaths&gt;
&lt;/configuration&gt;
&lt;/plugin&gt;
&lt;/plugins&gt;
&lt;/build&gt;</code><button class="clipboard" data-clipboard-target="#x25cf7706288f4d51"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div><div class="content hidden option-2">
<pre class="highlightjs highlight"><code class="language-kotlin hljs" data-lang="kotlin" id="x71d84ae09fd4e75">plugins {
id "org.jetbrains.kotlin.kapt" version "1.9.10"
}

dependencies {
kapt 'io.avaje:avaje-inject-generator:10.0'
}</code><button class="clipboard" data-clipboard-target="#x71d84ae09fd4e75"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div></div>

<div class="paragraph">
<p>3) Install Avaje Inject:</p>
</div>
<div class="listingblock primary">
<div class="title">Installing Avaje Inject</div>

<div class="switch"><div class="switch--item option-1 selected">Java</div><div class="switch--item option-2">Kotlin</div></div><div class="content option-1">
<pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java" id="x6b29210ea0034df5">public class App extends Jooby {
<pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java" id="xf7ac1fb05dc94b63">public class App extends Jooby {

{
install(AvajeInjectModule.of()); <i class="conum" data-value="1"></i><b>(1)</b>
Expand All @@ -618,9 +653,9 @@ <h3 id="avaje-inject"><a class="anchor" href="#avaje-inject"></a><a class="link"
public static void main(String[] args) {
runApp(args, App::new);
}
}</code><button class="clipboard" data-clipboard-target="#x6b29210ea0034df5"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
}</code><button class="clipboard" data-clipboard-target="#xf7ac1fb05dc94b63"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div><div class="content hidden option-2">
<pre class="highlightjs highlight"><code class="language-kotlin hljs" data-lang="kotlin" id="x4dea7546d9574c2a">fun main(args: Array&lt;String&gt;) {
<pre class="highlightjs highlight"><code class="language-kotlin hljs" data-lang="kotlin" id="x6b9f4f79b3f420e">fun main(args: Array&lt;String&gt;) {
runApp(args) {
install(AvajeInjectModule.of()) <i class="conum" data-value="1"></i><b>(1)</b>

Expand All @@ -629,7 +664,7 @@ <h3 id="avaje-inject"><a class="anchor" href="#avaje-inject"></a><a class="link"
service.doSomething()
}
}
}</code><button class="clipboard" data-clipboard-target="#x4dea7546d9574c2a"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
}</code><button class="clipboard" data-clipboard-target="#x6b9f4f79b3f420e"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div></div>

<div class="colist arabic">
Expand All @@ -647,32 +682,32 @@ <h3 id="avaje-inject"><a class="anchor" href="#avaje-inject"></a><a class="link"
<div class="sect3">
<h4 id="avaje-inject-property-injection"><a class="anchor" href="#avaje-inject-property-injection"></a><a class="link" href="#avaje-inject-property-injection">1.1. Property Injection</a></h4>
<div class="paragraph">
<p>Configuration properties can be injected using the <code>@Named</code> annotation. As Avaje checks beans at compile time, <code>@InjectModule(requires={String.class})</code>:</p>
<p>Configuration properties can be injected using the <code>@Named</code> annotation. As Avaje checks beans at compile time, <code>@External</code> is required to prevent false-positive compilation errors:</p>
</div>
<div class="listingblock">
<div class="title">application.conf</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash" id="xa7ef2c378bc146d3">currency = USD</code><button class="clipboard" data-clipboard-target="#xa7ef2c378bc146d3"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash" id="x3833f22d341f4f8a">currency = USD</code><button class="clipboard" data-clipboard-target="#x3833f22d341f4f8a"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div>
</div>
<div class="listingblock primary">


<div class="switch"><div class="switch--item option-1 selected">Java</div><div class="switch--item option-2">Kotlin</div></div><div class="content option-1">
<pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java" id="x5bcfd539d0db4486">@Singleton
<pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java" id="x5507dd0370404cdb">@Singleton
public class BillingService {

@Inject
public BillingService(@Named("currency") String currency) {
public BillingService(@External @Named("currency") String currency) {
...
}

}</code><button class="clipboard" data-clipboard-target="#x5bcfd539d0db4486"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
}</code><button class="clipboard" data-clipboard-target="#x5507dd0370404cdb"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div><div class="content hidden option-2">
<pre class="highlightjs highlight"><code class="language-kotlin hljs" data-lang="kotlin" id="x3971eecd203c4698">@Singleton
class BillingService @Inject constructor(@Named("currency") currency: String) {
<pre class="highlightjs highlight"><code class="language-kotlin hljs" data-lang="kotlin" id="x221e611e7b3b4ba3">@Singleton
class BillingService @Inject constructor(@External @Named("currency") currency: String) {
...
}</code><button class="clipboard" data-clipboard-target="#x3971eecd203c4698"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
}</code><button class="clipboard" data-clipboard-target="#x221e611e7b3b4ba3"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div></div>

</div>
Expand All @@ -685,7 +720,7 @@ <h4 id="avaje-inject-mvc-routes"><a class="anchor" href="#avaje-inject-mvc-route
<div class="title">MVC and Avaje Inject</div>

<div class="switch"><div class="switch--item option-1 selected">Java</div><div class="switch--item option-2">Kotlin</div></div><div class="content option-1">
<pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java" id="x6fc781bdf35849e0">public class App extends Jooby {
<pre class="highlightjs highlight"><code class="language-java hljs" data-lang="java" id="xfc5332ef66ad4ccb">public class App extends Jooby {

{
install(AvajeInjectModule.of()); <i class="conum" data-value="1"></i><b>(1)</b>
Expand All @@ -696,15 +731,15 @@ <h4 id="avaje-inject-mvc-routes"><a class="anchor" href="#avaje-inject-mvc-route
public static void main(String[] args) {
runApp(args, App::new);
}
}</code><button class="clipboard" data-clipboard-target="#x6fc781bdf35849e0"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
}</code><button class="clipboard" data-clipboard-target="#xfc5332ef66ad4ccb"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div><div class="content hidden option-2">
<pre class="highlightjs highlight"><code class="language-kotlin hljs" data-lang="kotlin" id="x177a74ea17a54e15">fun main(args: Array&lt;String&gt;) {
<pre class="highlightjs highlight"><code class="language-kotlin hljs" data-lang="kotlin" id="x397275839c53461d">fun main(args: Array&lt;String&gt;) {
runApp(args) {
install(AvajeInjectModule.of()) <i class="conum" data-value="1"></i><b>(1)</b>

mvc(MyController::class) <i class="conum" data-value="2"></i><b>(2)</b>
}
}</code><button class="clipboard" data-clipboard-target="#x177a74ea17a54e15"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
}</code><button class="clipboard" data-clipboard-target="#x397275839c53461d"><img src="/images/clippy.svg" class="clippy" width="13" alt="Copy to clipboard"></button></pre>
</div></div>

<div class="colist arabic">
Expand All @@ -723,7 +758,7 @@ <h4 id="avaje-inject-mvc-routes"><a class="anchor" href="#avaje-inject-mvc-route
<p>The lifecycle of <code>MyController</code> is now managed by Avaje Inject.</p>
</div>
<div class="paragraph">
<p>In Avaje Inject, the dependency graph is typically validated when the application compiles. As beans provided by Jooby Modules are registered at runtime, you must add <code>@InjectModules(requires={String.class, &lt;other Jooby Module Provided Bean ClassNames&gt;…​})</code> to inform the avaje processor that these beans are provided at runtime.</p>
<p>In Avaje Inject, the dependency graph is typically validated when the application compiles. As beans provided by Jooby Modules are registered at runtime, you must add <code>@External</code> when injecting these runtime beans into <code>@Singleton</code> classes to inform the avaje processor that these beans are provided at runtime.</p>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit b698790

Please sign in to comment.