You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/asciidoc/mvc-api.adoc
+9-31Lines changed: 9 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
== MVC API
2
2
3
-
MVC API is an alternative way to define routes in Jooby. It generates source code to define and execute routes.
3
+
MVC API is an alternative way to define routes in Jooby. It generates source code to define and execute routes. The generated class are suffixed with `_` (underscore).
4
4
5
5
If you use Gradle 6.0 or a later version, you can leverage incremental annotation processing support,
6
6
which means that Gradle only compiles classes that changed since the last compilation, and only runs
@@ -14,8 +14,7 @@ The annotation processor has two options allowing you to control incremental pro
14
14
tasks.withType(JavaCompile) {
15
15
options.compilerArgs += [
16
16
'-parameters',
17
-
'-Ajooby.incremental=true',
18
-
'-Ajooby.services=true'
17
+
'-Ajooby.incremental=true'
19
18
]
20
19
}
21
20
----
@@ -26,26 +25,13 @@ tasks.withType(JavaCompile) {
26
25
kapt {
27
26
arguments {
28
27
arg('jooby.incremental', true)
29
-
arg('jooby.services', true)
30
28
}
31
29
}
32
30
----
33
31
34
32
By setting `jooby.incremental` to `false` you can disable incremental processing entirely, which means
35
33
the regardless what's changed, the whole project is recompiled each time. Defaults to `true`.
36
34
37
-
The generated bytecode is responsible for registering routes, retrieving and invoking your controllers.
38
-
Jooby loads these classes with Java's service-provider loading facility by default. To make this work,
39
-
a so-called _provider configuration_ file needs to be created alongside with the generated classes.
40
-
The content of this file is dependent on all MVC controllers, therefore the annotation processor
41
-
must operate in *aggregating* mode, in which _all generated_ classes are rewritten each time.
42
-
43
-
You may disable the generation of the provider configuration file by setting `jooby.services` to `false`
44
-
(the default is `true`). This allows the annotation processor to run in *isolating* mode: if you
45
-
change e.g. `HelloController` only, then only the class responsible for registering the routes for
46
-
`HelloController` will be regenerated. This however will force Jooby to load the generated classes
47
-
with reflection instead of the service-provider loading facility.
48
-
49
35
The package `annotation` contains all the annotations available for MVC routes.
50
36
51
37
.MVC API:
@@ -681,7 +667,7 @@ logic in the javadoc:ExecutionMode[EVENT_LOOP]:
681
667
682
668
public class App extends Jooby {
683
669
{
684
-
mvc(new MyController());
670
+
mvc(new MyController_());
685
671
}
686
672
687
673
public static void main(String[] args) {
@@ -697,7 +683,7 @@ import io.jooby.*
697
683
698
684
fun main(args: Array<String>) {
699
685
runApp(args, EVENT_LOOP) { <1>
700
-
mvc(MyController())
686
+
mvc(MyController_())
701
687
}
702
688
}
703
689
----
@@ -713,7 +699,7 @@ Similarly, if you need to run all mvc routes in the javadoc:ExecutionMode[WORKER
713
699
public class App extends Jooby {
714
700
{
715
701
dispatch(() -> {
716
-
mvc(new MyBlockingController()); <1>
702
+
mvc(new MyBlockingController_()); <1>
717
703
});
718
704
}
719
705
@@ -731,7 +717,7 @@ import io.jooby.*
731
717
fun main(args: Array<String>) {
732
718
runApp(args, EVENT_LOOP) {
733
719
dispatch {
734
-
mvc(MyBlockingController()) <1>
720
+
mvc(MyBlockingController_()) <1>
735
721
}
736
722
}
737
723
}
@@ -823,7 +809,7 @@ Executor must be registered using via services or executor utility method:
0 commit comments