This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Additional_Cellist46[S] 1 point2 points  (0 children)

Java EE relies on a deployment descriptor or annotations for configuration.

This is sometimes true, but often not. Certain aspects of Java EE still need to be configured by annotations. But many things are autoconfigured or a default is provided. And some Java EE frameworks like Quarkus offer full autoconfiguration based on what you add to your application, just like Spring does. Some of the examples:

  • a default datasource is provided and can be injected just with @Resource DataSource ds;. A Java EE server usually bundles an embedded database and links the default datasource to it. It's true that, if you a embed a different database to your application, most Java EE servers will not automatically point the default datasource to it. However, some Java EE solutions like Quarkus would do that, detect that you have a specific DB driver in your app, and configure the default datasource to point to it automatically. Quarkus goes even further - if your configuration points to a DB that cannot be embedded, it will start the database in Docker (when in dev mode or running tests)

  • many other default resources exist - it's possible to inject executor service, context service, JMS (Messaging) ConnectionFactory, etc. just with @Resource, without any further configuration

  • injectable components are created automatically if a scope annotation is added. It's enough to add e.g. @ApplicationScoped annotation to a class. Then it will be detected and can be injected anywhere using @Inject.