Docker for Java development
The promise to use Docker during development is to provide a consistent test environment on your development machines and the different environments you use (such as QA and manufacturing).
The last thing you want to do is slow your development cycle.
Even if you or your team are not involved in using Docker on development computers as part of this process, there are several use cases for modifying and debugging code running in the container. For example, a developer can use Docker to mimic the production environment to reproduce errors or other conditions. In addition, the ability to debug remotely on a docked host can enable practical troubleshooting of a running environment such as QA.
Let us take as an example a simple application that emulates the console's password change utility.
The program asks for the login and the current password. After verifying the credentials, it prompts you to enter your new password twice. If the passwords do not match, it asks for a new password again until they match and then changes the password. Password verification and change methods are not implemented for this example.
If you try to run this application in IntelliJ IDEA, it will throw a NullPointerException exception. This is because the IDE runs Java applications using the javaw: command with no associated console. As a result, System.console () returns null. You can try to compile JavaPassFromConsole.java and run it with java command from the command line to check if the code is really correct, or run this code with Docker.
Comments
Post a Comment