Tag Archives: Java
Build IVR System using Amazon Polly, Lambda and Twilio
Building an intelligent IVR system with a Bot handling the interaction with your end users and bringing in humans based on pre-defined events would bring a lot of automation and remove mundane manual activities which takes up lot of time for a person. This can be achieved using cloud services provided by cloud providers such as Amazon, Google, Azure etc and communication service providers such as Twilio. In this post, you will learn about how to create or build an intelligent or smart IVR system using some of the following: Use Amazon Polly to create one or more custom text-to-speech audios and store the same at predefined locations in AWS …
Java Code to Invoke Twilio Rest API to Play Audio
This post represents sample Java code (example) to demonstrate how to invoke Twilio Rest API to play pre-recorded audio in a phone call made to the users. The code could be used to in some of the following usecase: Alert users via phone call in relation to different kind of critical events such as security issues, production downtime, production issues etc. Play different kind of messages to users in relation to different occasions such as birthdays, anniversaries etc. The code can be used to play audio stored at locations such as cloud platform storage (AWS storage, Google/Azure storage etc.) The key is to provide public access (READ permission) to these …
Twilio & AWS S3 using Java & Spring Boot – Code Example
Twilio is a very popular communication service which could be used to send SMS, make the phone or video calls to people in different countries. In this post, you will learn about creating Java and Spring Boot app in relation to how to use Twilio phone service to make a phone call and play audio stored at AWS S3 bucket. The following are some of the related use cases: Play security and other alerts via phone calls Play messages of any kind via phone calls The following are some of the topics which would be covered in this post: Define VoiceService interface defining APIs Create Twilio Voice Service implementation Load …
AWS Temporary Credentials with Java & Spring Boot
AWS Security Token Service (STS) is an Amazon web service which enables you to request temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users or for users that you authenticate (federated users). By default, the AWS Security Token Service (AWS STS) is available as a global service, and all AWS STS requests go to a single endpoint at https://sts.amazonaws.com. You can optionally send your AWS STS requests to endpoints in any of the AWS regions shown in the table that follows. In this post, you would learn how to use AWS security token service to create temporary security credentials with Spring Boot and Java app. I would recommend …
10 Spring Framework Interview Questions for Freshers
Spring Framework is one of the most popular and widely used Java frameworks which makes it very easy to create a Java application/web application using several out-of-box framework components provided by Spring. Thus, it is imperative that beginners starting to do Java web app would end up using Spring framework for building the app. From that perspective, it becomes of great importance for beginners to take note of some of the basic concepts related to which interview questions can be asked. In this post, you will learn some of the Spring framework fundamentals concepts which could be asked in form of interview questions and answers. These questions and answers may …
Amazon S3 with Spring Boot & Java – Sample Code
Amazon Simple Storage Service (S3) is an AWS object storage platform which helps you to store the files/data in form of objects, and, store and retrieve any amount of data from anywhere – websites and mobile apps, corporate applications, and data from IoT sensors or devices. Each file stored in Amazon S3 (as an object) is represented using a key. The following are some of the usecases where S3 could be used. Thus, it becomes of utmost importance to understand how to interact with Amazon S3 API using AWS SDKs including AWS Java SDK. Backup & recovery Data archiving Big data analytics Disaster recovery Cloud-native application data Hybrid cloud storage …
Amazon Polly Hello World with Java & Spring Boot
Amazon Polly is one cool AWS service which can be used to achieve requirements such as creating business, security alerts via phone call. When integrated with communication providers such as Twilio, several value-added services could be created using Amazon Polly AWS service. In this post, you will learn about creating a sample Java app which uses Amazon Polly service for converting text to speech. You should be able to listen to the following text using the program given below: Hello World! How are you doing? This is Polly. I am happy to talk with you. The following are some of the aspects covered in this post: Create a Spring Boot app …
Spring Boot CommandLineRunner Code Example
Spring Boot helps you quickly get started with building a Spring-based web app in no time. All you need to do is go to Eclipse IDE, create a new Spring Starter Project and that is it. This is provided you installed Eclipse plugin, Spring Tools (aka Spring IDE and Spring Tool Suite) by going to Help > Eclipse Marketplace… and searching for “spring tools” keyword. Often, one wants to run a Spring Boot app as a Java application as like a traditional Java program and test different parts of their app. In this post, you will get a template code for quickly getting started with Command Liner which would help …
Top 5 Java Rule Engine for 2017-2018
This is a list of top 5 rules engine which can be used in your Java application. Out of below 5 frameworks, Drools is the most popular one. Popularity Rule Engine Summary 1 Drools A Business Rules Management System (BRMS) solution which provides a core business rules engine (BRE), a web authoring and rules management application (Drools Workbench) and an Eclipse IDE plugin for core development 2 OpenRules A general purpose business rules and decision management system 3 EasyRules EasyRules provides the Rule abstraction to create rules with conditions and actions, and the RulesEngine API that runs through a set of rules to evaluate conditions and execute actions. 4 JLisa A Clips-like Rule engine accessible from …
Top 10 Tricky Interview Questions for Java Developers
Here is a list of top ten (10) tricky / popular interview questions and answers for Java developers. I got these questions out from Stackoverflow. You are a Junior or Intermidiate level Java developer and planning to appear for Java developer interviews in near future, you would find these questions to be useful enough. Q1: Is Java “pass-by-reference” or “pass-by-value”? Ans: Java is always “pass by value”. Read the details on this page, Is Java “pass-by-reference” or “pass-by-value”? Q2: How to create a memory leak in Java? Ans: This is possible by making use of Class loader and ThreadLocal. Read the details on this page, Creating a memory leak in Java Q3: What is difference between package private, public, protected, and private? Ans: A private member …
Setup Environment for Google AppEngine Java Project
This blog presents tips and techniques on how to set up environment for deploying Java web app on Google AppEngine using GCloud SDK. Same environment can as well be used for deploying Spring boot web app. Following steps are described later: Install Google Cloud SDK Install Cloud SDK Appengine Java component Create Appengine project in Google Cloud Console Authorize GCloud Configure Appengine project using GCloud Install Google Cloud SDK Download and install Google Cloud SDK. The instructions for downloading and installing Google Cloud SDK can be found on Installing Cloud SDK page. Unzip or Untar the downloaded file and go to the google-cloud-sdk folder. Execute install.sh or install.bat appropriately from …
Spring Boot with JSP Pages – Code Example
Following needs to be done to setup Spring boot web app with JSP pages Create a Spring Starter Project Create a Spring Starter Project by selecting “Web” as one of the dependencies. This will create a Springboot project. POM.xml Entries Place following entries in pom.xml for processing JSP pages Configuration in application.properties Place following configuration in application.properties Create Controller class Create a sample controller class such as following: Create JSP pages Create a folder src/main/webapp/WEB-INF/views Create a file index.jsp. Place the content such as following: Run Project as Spring Boot App Access URL such as http://localhost:8080/ in browser. Following would be displayed.
Springboot MongoDB Repository – Code Example
This blog represents code required to create a Spring boot application that uses Spring Data MongoRepository interface to connect with MongoDB database. Step 1: Create a Springboot Maven project Create a new Spring Starter Project using Eclipse IDE. This would create a class annotated with @SpringBootAnnotation. Step 2: Include Spring Data Mongo support in pom.xml Step 3: Configure Mongoclient for database connectivity Create a Configuration class which is used to instantiate a MongoClient for connecting with MongoDB database. Step 3: Define MongoDB details in application.properties Step 4: Invoke MongoRepository instance Place following code in SpringBootAnnotation class for invoking MongoRepository instance (UserDAO in the code given below). In ideal scenario, you would want …
Spring Boot Web Application with Eclipse in 5 Clicks
This article represents tips and code samples to get you started quickly with Spring web application within few clicks. Please feel free to comment/suggest if I missed mentioning one or more important points. Also, sorry for the typos. Steps to get started with Spring Boot Web Application Go to Help > Eclipse Marketplace… and search type “spring sts” in Find text field under Search tab. Install the entry with the title such as “Spring Tool Suite (STS) for Eclipse Release”. Once installed, you would be asked to restart the Eclipse. Go ahead and restart the eclipse. Open the new Project selector window using shortcut, CTRL + N. Type “Spring Starter” …
Java – How to Fix java.lang.NoClassDefFoundError?
This article represents tips on How to Fix java.lang.NoClassDefFoundError when compiling a particular Java file. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. Following are the key points described later in this article: How to reproduce java.lang.NoClassDefFoundError? Why does the java.lang.NoClassDefFoundError occur in the first place? How to Fix the Error? How to reproduce java.lang.NoClassDefFoundError? Take a look at following Class file. package com.test; public class HelloWorld { public static void main(String[] args) { System.out.println(“Hello World! How are you?”); } } Following are steps to reproduce the java.lang.NoClassDefFoundError. Save the above file as HelloWorld.java within any folder. Compile …
Java – How to Fix java.lang.UnsupportedClassVersionError Error?
This article represents tips on how to fix Java error such as UnsupportedClassVersionError. Please feel free to comment/suggest if I missed to mention one or more important points. Also, sorry for the typos. How to Reproduce the Error? Set the JAVA_HOME with one version of Java. And, include “bin” of different Java version in PATH variable. Compile the class, say, HelloWorld.java with “javac” command Start the JVM with following class: “java HelloWorld” With above, you could see error such as following: java.lang.UnsupportedClassVersionError: HelloWorld : Unsupported major.minor ver sion 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) …
I found it very helpful. However the differences are not too understandable for me