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: _posts/2015-03-17-modularity.md
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,19 +20,16 @@ We chose the Service Loader mechanism from Java as built in modules system in Pi
20
20
You can create a modular application using [ServiceLocator]({{ site.coreurl }}/src/main/java/ro/pippo/core/util/ServiceLocator.java) class (trivial wrapper over Service Loader concept).
21
21
22
22
To improve the modularity mechanism, we added the concept of [Initializer]({{ site.coreurl }}/src/main/java/ro/pippo/core/Initializer.java).
23
-
When Pippo starts up an application, it scans the classpath roots, looking for files named `pippo.properties`. It reads
24
-
every pippo.properties file it finds, and it instantiates and execute the initializers defined in those files.
25
-
26
-
To demonstrate the initializer concept I added a dump [FreemarkerInitializer]({{ site.codeurl }}/pippo-template-parent/pippo-freemarker/src/main/java/ro/pippo/freemarker/FreemarkerInitializer.java) in pippo-freemarker module. In our example,
27
-
the [pippo.properties]({{ site.codeurl }}/pippo-freemarker/src/main/resources/pippo.properties) file (which should be packaged in the root of the classpath) contains only one line:
When Pippo starts up an application, it scans the classpath roots, looking for _Initializer_ implementations.
24
+
It instantiates and execute the initializers defined via Service Loader.
25
+
Of course you can create `META-INF/services` manually but the easy mode is to use the `@MetaInfServices` annotation.
26
+
The `@MetaInfServices` annotation generates _META-INF/services/*_ file from annotations that you placed on your source code, thereby eliminating the need for you to do it by yourself.
32
27
28
+
To demonstrate the initializer concept I added a dump [FreemarkerInitializer]({{ site.codeurl }}/pippo-template-parent/pippo-freemarker/src/main/java/ro/pippo/freemarker/FreemarkerInitializer.java) in pippo-freemarker module.
0 commit comments