Server-side options

The generator will now start asking us about the server-side options that we need. Let's go through them one by one:

  • Question 1: This prompt asks for a base name for the application, which is used to create the main class filenames, database names, and so on. By default, JHipster will suggest the current directory name if it doesn't contain any special characters. Let's name our application store. Please note that the files will be created in the directory you are currently in:
  • Question 2: This prompt asks for a Java package name. Let's choose com.mycompany.store:
  • Question 3. This prompt asks whether we need to configure the JHipster Registry for this instance. The JHipster registry provides service discovery and config server implementation, which is very useful for centralized configuration management and scaling the application. For this use case, we won't need it, so let's choose No. We will learn more about the JHipster Registry in Chapter 8, Microservice Server-Side Technologies:

  • Question 4: This prompt asks us to select an authentication mechanism. Here, we are presented with three options:
    • JWT authentication
    • HTTP Session Authentication
    • OAuth 2.0 / OIDC Authentication

We already saw how these differ in the previous chapter. For our use case, let's choose JWT authentication:

  • Question 5: This prompt asks us to select a database type; the options that are provided are SQL, MongoDB, Couchbase, and Cassandra. You can also choose to have no database. We learned about various database options in the previous chapter. For our application, we'll choose a SQL database:
  • Question 6: This prompt asks us to choose a specific SQL database that we would like to use in production; the available options are MySQL, MariaDB, PostgreSQL, Oracle, and Microsoft SQL Server. Let's choose MySQL:
  • Question 7: This prompt asks us to choose between our chosen SQL database and the H2 embedded database for development. The H2 embedded DB is especially useful as it makes development faster and self-contained, without the need to have a MySQL instance running. Let's choose the H2 with disk-based persistence option here since it's lightweight and easier to use in development compared to having a full-fledged DB service running:
If your use case requires working with persisted data in development and if the model isn't going to change often, then you could also choose MySQL for development as it would give you a faster startup time. This is because the embedded H2 DB doesn't need to be initialized. However, the downside is that each time you make schema changes or recreate entities, you would have to update the DB using generated Liquibase diff changelogs manually or wipe the DB manually and start over again. With an embedded H2 DB, you could run ./gradlew clean to wipe it.

  • Question 8This prompt asks us to choose a Spring cache implementation. We can choose between no-cache, Ehcache, Caffeine, Hazelcast, Infinispan, Redis, and Memcached. Since we learned about these in the previous chapter, let's go ahead and choose Hazelcast here:

  • Question 9This prompt asks us to choose if we need a second level cache for Hibernate. Let's choose Yes. It will use the same cache implementation we chose for the previous question:
  • Question 10This prompt let's us choose a build tool to use for the project; the options are Maven and Gradle. Let's choose Gradle here since it is more modern and powerful:

  • Question 11This prompt is interesting as it presents various additional options supported by JHipster. The options are as follows:
    • Elasticsearch: Adds Elasticsearch support for the generated entities
    • WebSockets: Adds WebSocket support using Spring WebSocket, SocketJS, and the Stomp protocol
    • API first development with OpenAPI-generator: Adds OpenAPI generator support for API first development
    • Apache Kafka: Adds support for an asynchronous queue using Kafka

Let's keep it simple and choose WebSockets using Spring Websocket:

Now, we'll learn about client-side options.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset