Skip to main content

Posts

Five most useful spring modules

  Java Spring framework is one of the popular java frameworks. A thread on 5 commonly used spring modules 1. Spring Boot and Spring MVC These modules makes it easy and quick to create stand-alone, production-grade Spring based Applications that you can "just run". Example Use:- A RESTful service with self-container server. 2. Spring Batch This module is used to build batch applications that need to recurrently process large volumes of data. Features: Chunk based processing, retry, skip Example Use:- Everyday, read data of daily trades from database and update the credit on customer's accounts. 3.Spring Data Provides a spring based programming model for accessing data. This module has very powerful features and supports wide range of databases. Example Use:- Read, Write data from PostgreSQL for your application. 4.Spring Cloud Provides tools for developers to quickly build some of the common patterns of distributed systems. Libraries for Service registration and discovery,
Recent posts

How to choose database when designing system

When designing a system, you need to choose an appropriate database based on the use cases and other considerations. Sharing an insightful article by  Satish Chandra Gupta  on this topic. Do read to improve your knowledge on databases https://towardsdatascience.com/datastore-choices-sql-vs-nosql-database-ebec24d56106  

Five important aspects of microservices

  5 important aspects/components of microservices architecture 1. Microservices - Services that are built small enough so that their entire lifecycle can be owned and managed by a small team. 2. Service Discovery - A mechanism of how microservices can locate each other over network.  Example : if Microservice A wants to call microservice B:  It will use service discovery mechanism to fetch IP address and port of B and then call B. Implementations : ZooKeeper, Consul, etcd, Eureka 3. External configuration - Enable services to run on various environments without a code modification inside the service. Enable different configuration values for those services for different environments.  Dynamically change configurations without changing application code or restart/redeploy application. Example - DB credentials and other details, application properties, environment variables for Dev, QA and Prod env. Implementations : Consul, Spring cloud (enables various datastores to store needed con

More about Me

You can find more about me on my linkedIn profile  https://www.linkedin.com/in/amolrlimaye/   I have written a blog series on microservices which you can read here  https://medium.com/@amol.limaye   My open source contributions are less, but you can see my github activity here  https://github.com/amollimaye

How to take a full webpage screenshot using AShot library

AShot library Ashot library by yandex.ru is something which I recently found. It can be used for multiple browsers. It is very simple to use. Just add maven dependency in your java code. < dependency > < groupId > ru.yandex.qatools.ashot </ groupId > < artifactId > ashot </ artifactId > < version > 1.5.2 </ version > </ dependency > </ pre > Then call the takeScreenshot() function,as shown below and you have a screenshot file. new AShot () .shootingStrategy( ShootingStrategies . viewportPasting( 100 )) .takeScreenshot(myWebDriver); You could even select specific html elements and take their screenshots. WebElement webElement = webDriver . findElement( By . cssSelector( "#element_to_be _captured" )); new AShot () .takeScreenshot(myWebDriver, webElement); All this can be found at below repository. https://github.com/yandex-qatools/ashot Know of any more libraries

How to convert a CSV file to XLSX

I wrote this utility for a friend of mine who wanted to convert large (~50MB) CSV files to XLSX. The CSV files had comma "," as a delimiter. I have used apache poi utility in this program. https://www.apache.org/dyn/closer.lua/poi/release/RELEASE-NOTES.txt This code uses SXSSFWorkbook class. The SXSSFWorkbook class uses "BigGridDemo" strategy, where only portions being processed are kept in memory. There are temporary files created which store the rest of the temporary data. setCompressTempFiles() method allows these temp files to be compressed. The size of these files can get quite large. The data to be converted was UTF-8 encoded data. So, we are using  OutputStreamWriter, where we specify the encoding of the data. If you do not need the encoding, just remove that parameter from the constructor call of OutputStreamWriter. The system where this ran, supported Java 7, so have not used features in java 8, such as try with exceptions. import java.io.*; im

Interview Task: Java exercise to test basic Java skills

Here is a problem to test following basic Java skills, with increasing difficulty. Depending on what skills are expected from you. 1. OOPS concepts 2. Code Design 3.  Knowledge of Java classes 4. Collections 5. J2EE Interview Tasks Task 1 Create an application that maintains information of all students in a class. The information of each student includes Name, Age and Roll number. The application should be able to do the following, through a console: (No need for UI) 1. Add a new student information 2. Delete a student information 3. Edit Student information -- Roll number should not be editable 4. List all students in a class --While evaluating the solution, check what are the Interfaces, abstract classes are created and the reasons to do so. Which collection is used to store the list of students. How do you ensure a student is not added twice. Task 2 Now functionality that will allow users to be sorted alphabetically by Name. Also add another functional