Loading environment properties from custom .env file

In all my previous post under DotEnv, I showed how to load environment properties from a file named “.env”. The “.env” file can be present in the project directory or in some other directory. By default, DotEnv is configured to search under project directory. In one of my previous posts, I showed how to change…… Continue reading Loading environment properties from custom .env file

Loading .env file from a specific folder

In previous post under DotEnv, I showed that by default DotEnv checks for “.env” file in the project directory when static “load” method is called. So if your project directory is in “D:\ProgrammingConcepts\JavaSEConcepts\DotEnvConcepts” the “.env” file should be present directly under the “DotEnvConcepts” folder. If present in subfolders under “DotEnvConcepts” it will not load that…… Continue reading Loading .env file from a specific folder

Loading .env files

In this post under DotEnv, I will show with example how to load a .env file. Below is the complete main class Main class 1 package defaultPackage; 2 3 import io.github.cdimascio.dotenv.Dotenv; 4 import io.github.cdimascio.dotenv.DotenvEntry; 5 6 public class Example1 { 7 public static void main(String[] args) { 8 Dotenv dotenv = Dotenv.load(); 9 for(DotenvEntry entry…… Continue reading Loading .env files