Clarification on Bootique modules

7 views
Skip to first unread message

Laurian Angelescu

unread,
Nov 12, 2021, 8:17:14 PM11/12/21
to Bootique User Group

I understand Bootique has been designed to be modular, I see the modules that make other services available for Bootique app, e.g. bootique-jdbc, etc;

I don't quite understand what services require a port to a Bootique module and what services do not.

For example, to use a library in my application, suppose it's gson or log4j, would I have to wrap it into a module before using it? Would it work if I used it, as in typical Java maven projects, without having a bootique-gson?

I appreciate the help.

Laurian

Andrus Adamchik

unread,
Nov 13, 2021, 3:22:08 AM11/13/21
to Laurian Angelescu, Bootique User Group
Hi Laurian,

Great question. It goes to the core of why Bootique even exists. Yes, modules are at the heart of Bootique and allow for some pretty cool functionality. But modules are not a requirement to use a dependency. You already have the keywords in your message to make this distinction - "libraries" and "services". To decide whether you need a module or not, you may apply an informal classification: is it a library or a framework?

Objects from a library can be used as is without any extra configuration. They are relatively cheap to create and hence do not require reuse within the app. So no module is needed. You just use them as is. A framework on the other hand has "services" that are objects of a different kind:

* May require complex configuration
* May require a dynamic strategy to create different subclasses of the same service.
* May be slow/expensive to create / use significant system resources (and hence require reuse)
* May require lifecycle management (explicit startup and shutdown)

Bootique "manages" services, i.e. configures, creates in a certain scope (usually a singleton), makes them injectable into other objects, so once configured they can be reused.

To give an example, JSON serialization would normally fall in the "library" category. While JDBC is a "framework", with connection pool being a reusable injectable service.

There's of course a large grey area in between libraries and frameworks. E.g. ObjectMapper from Jackson (a popular JSON library) can be created on the spot as needed (so Jackson can be treated as a library). But sometimes ObjectMapper requires special configuration, in which case it can be made into an injectable service within a module (Bootique itself happens to have a JacksonService).

Hope this helps to clarify it.

Andrus



--
You received this message because you are subscribed to the Google Groups "Bootique User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bootique-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bootique-user/4261ef85-ec9b-4470-afbb-84d31ddf1a2cn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages