Get the latest version of Java following the guide in the official website.
After cloning the bootstrap, follow the kickoff guide. And happy coding!
-
Install the Java Development Kit (JDK), available in https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
-
Set Java Home as an environment variable in your computer. To do so, you must follow these steps:
a. Launch the Terminal and type in sudo su.
b. Open the bashsrc file for edition by typing gedit .bashrc
c. Add the following lines at the end of the file:
JAVA_HOME=/usr/lib/jvm/default-java/bin
export JAVA_HOME
PATH=$PATH:$JAVA_HOME
export PATH
d. Close and reopen the terminal and type echo $JAVA_HOME, and verify that it has been set properly.
-
Verify proper installation by typing java -version in a new terminal.
We use Lombok for DTOs and logs.
It provides annotations to easily add getters/setters/constructors/logs to your code.
You can always override the methods that Lombok generates if any additional logic were required.
- Go to File > Settings > Plugins.
- Click on Browse repositories...
- Search for Lombok Plugin.
- Click on Install plugin.
- Restart IntelliJ IDEA.
Then you need to go to Preferences > Build, Execution, Deployment > Compiler > Annotation Processors and make sure of the following:
- "Annotation Processing" box is checked.
- "Obtain processors from project classpath" option is selected.
We use the IntelliJ Save Action plugin to format the code on save, organize imports and methods.
Follow these instructions to install it:
- Go to File > Settings > Plugins.
- Search for plugin “Save Actions” and click install.
- Search for “Save Actions” in the panel Settings and configure it as follows:
https://plugins.jetbrains.com/plugin/7642-save-actions
We follow the Google Java code style and the best way to adhere it is using the IntelliJ automatic formatter. To accomplish this we need to configure the code style in IntelliJ using the google xml code style configuration file.
You can find the xml file here https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml
And follow this instructions to import it:
- Download the .xml.
- Go to File > Settings > Editor > Code style.
- Import the .xml:
- Go to the Java section and change the indent size to 4.
A linter is a tool that can be used to analyze source code and flag errors, bugs, style errors, etc. SonarLint is a plugin for IntelliJ that exists with this purpose. In order to configure it, follow these instructions:
- Go to File > Settings > Plugins.
- Search for plugin "Sonarlint" and select "Browse repositories". The following screen will appear:
The tool will be automatically configured in IntelliJ. When writing code, some problematic sections will be highlighted and the tool will provide suggestions to fix the potential bugs.
The tool can be customized by changing highlight colors if desired. To do this go to File > Settings SonarLint:
Change the database name, user and password in the properties file for your own
They are located in the application.properties file
spring.datasource.url=jdbc:postgresql://localhost:5432/DATABASENAME
spring.datasource.username=DBUSERNAME
spring.datasource.password=DBPASSWORD
In Java 11, new Garbage Collection options have been added for measuring and managing this process, as well as for enhanced performance.
-
Epsilon : Epsilon removes the impact that the GC has on performance. You can use it to see how garbage collection affects your app's performance and what your memory threshold is, since it'll tell you when it runs out.
-
ZGC (Z Garbage Collector) : ZGC's design works well with applications with large heap sizes. It manages these heaps with pause times under 10ms and with little impact on throughput. These times are better than those of G1's.
Command Line Options | Notes |
---|---|
-XX:+UnlockExperimentalVMOptions | Unlock Java experimental options. |
-XX:+UseEpsilonGC | Use Epsilon GC |
-XX:+UseZGC | Use ZGC |
-XX:ConcGCThreads=X | Set number of GC threads(ZGC need) |
-XmxXg | Set heap size. |
-XX:HeapDumpOnOutOfMemoryError | Generate a heap dump if JVM runs out of memory |
-XX:OnOutOfMemoryError= | Run specified command when an out-of-memory error occurs. |
For more information read this link
The independent features available in the bootstrap will be kept in branches with the naming
strategy feature-name
. The bootstrap currently has the following features.
It provides an Auditable class that adds the creation date and last modified date to the classes that extend it.
It contains a small demonstration of the usage of routes, processors and API calls with the Apache Camel framework.
It explains how to deploy to AWS EB using a gradle task and adds the required dependencies, scripts and properties.
It provides the configuration and structure to perform a user authentication using JWT.
It provides the necessary configurations to include database tracking in the application using the Liquibase framework.
It introduces test schemas as a usage example of the Spock framework.
It adds the necessary configurations to include Swagger documentation in your project controllers.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
This project is maintained by Luciano Zemin and Lucas Mujica along with Jimena Roselló and Nicolas Gianni and it was written by Wolox.
java-bootstrap is available under the MIT license.
Copyright (c) 2017 Wolox
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.