Passing Command Line Arguments in Spring Boot applications

Spring Boot has a quite sophisticated environment variable and config properties management. Using the @Value Annotation In general terms, you can pass arguments with -DargumentName . For example: -DargumentName=”value1″ Then in your Spring Boot application, you can retrieve the value by doing: @Value(“${argumentName}”) private String myVariable Using the @Component Bean But you can do it … Read more

Spring Boot application.properties configuration

Configuring Application Properties is part of every day’s programmer Job. Spring Boot developers typically use the application.properties to code their own properties. This file, however, can also be used to set properties in common areas such as Logging, Web Server, Security etc. In this tutorial we will cover the most effective ways to configure Spring Boot.

Read more

Configuring SpringBoot starter parent dependency

If you open a Spring Boot project, you will see that at the top they all use a spring-boot-starter-parent as the parent in pom.xml. <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.0.RELEASE</version> <relativePath/> </parent> Parent Poms allow you to manage several aspects for the child projects such as: Dependency Management – Version of dependencies Configuration – Java Version and … Read more

SpringBoot starter templates

Spring Boot starter dependencies are a great way to simplify the dependencies section of your project’s build specification by aggregating commonly used dependencies under more coarse-grained dependencies. The first benefit of Spring Boot starter dependencies it that your build will transitively resolve the dependencies that are declared in the starter dependency. This way your dependency list will be smaller.
The other benefit is that they are typically organized by the type of functionality they bring to an application. For example, rather than specify specific libraries required for jpa (such as spring-orm, hibernate and spring data jpa) you can simply add the spring-boot-starter-data-jpa starter as a dependency.

Read more

Hello World con Spring Boot

Il framework Spring è stato lanciato come framework alternativo alla Java Enterprise Edition. Anziché utilizzare componenti come gli Enterprise JavaBeans con una struttura protocollare complessa, Spring ha proposto un approccio più semplice incentrato sull’iniezione delle dipendenze e sulla programmazione orientata agli aspetti (AOP) per ottenere funzionalità Enterprise dei componenti Java EE ma utilizzando semplici oggetti Java (POJO).
Il rovescio della medaglia è che anche se Spring è un framework facilmente estendibile, partendo da un core minimo, è piuttosto complesso in termini di configurazione.

Read more