heartin's blog

Technology Focus At JavaJee For Coming Days

Technologies and methodologies changes over time. We will have to learn new things and improve ourselves. I will list out few things that I will be focusing on in coming days.

  1. Java 8 has been around for long time now and even Java 9 has come out. It is high time we have mastered the new things in Java 8 and Java 9, especially functional programming, lambdas, streams and even the new APIs. So my primary focus will on mastering Java 8 and Java 9.

Maven Overview

Maven is primarily a build automation tool used for building mostly Java projects and is maintained by the Apache Software Foundation. Maven, a Yiddish word meaning accumulator of knowledge, was originally started in Jakarta Turbine project.

Maven’s objectives (as per maven.apache.org) are:

  1. Making the build process easy

  2. Providing a uniform build system

  3. Providing quality project information

Unit Testing Concurrency Code in Spring

Will list our common issues, tips and tricks for unit testing concurrency code written in Spring. You will usually be using a unit testing framework such as JUnit or TestNG.

Introduction to Caching Support in Spring Framework

Spring Framework provides support for transparently adding caching into an existing Spring application, with minimal impact on the code, similar to the transaction support. Spring also makes good use of annotations. This note is a summary of Spring’s documentation (see reference) on Caching, for quick reading and reference.

Introduction to Caching

A cache is a hardware or software component that stores data so future requests for that data can be served faster; the data stored in a cache might be the result of an earlier computation, or the duplicate of data stored elsewhere. A cache hit occurs when the requested data can be found in a cache, while a cache miss occurs when it cannot. Cache hits are served by reading data from the cache, which is faster than recomputing a result or reading from a slower data store. (Ref=Wikipedia)

Spring Boot Developer Tools and App Restart

The devtools module adds tools that can make the application development easier. This includes automatically applying sensible development-time configuration for features such as caching, auto restarting after changes etc. To include devtools support, we need to add spring-boot-devtools dependency to the build file.

A Quick Comparison of YAML with Properties File

YAML is a human friendly data serialization standard, which is mainly made for configuration files. YAML stands for YAML Ain't Markup Language. YAML can be used with many programming languages.

Externalized Configuration with Spring Boot

For externalized configurations, Spring Boot supports file formats such as YAML and the .properties file.

While properties file works with @PropertySource annotation, YAML does not. While we can configure more than one Spring profiles per properties file, we can have any with YAML files.

 

@ConfigurationProperties

Spring Boot Auto Configuration Overview

EnableAutoConfiguration

  1. EnableAutoConfiguration annotation attempt to guess and configure beans that you are likely to need.

  2. Auto-configuration classes are usually applied based on the presence or absence of, files or libraries in your classpath, beans you have defined, and properties.  

  3. Auto-configuration is always applied after user-defined beans have been registered.

[Theory+Example] Spring Boot Command Line Runner

If you need to run some specific code once the SpringApplication has started, you can implement the ApplicationRunner or CommandLineRunner interfaces. Both interfaces work in the same way and offer a single run method which will be called just before SpringApplication.run(…​) completes.

 

The CommandLineRunner interfaces provides access to application arguments as a simple string array, whereas the ApplicationRunner uses the ApplicationArguments interface.

 

Pages

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!