Category Archives: Java
Java – Configure MySQL for Google Appengine (Standard)
In this post, you will learn about how to configure MySQL properties in your Spring Boot application for deploying it on Google AppEngine (Standard) environment. This article assumes that the MySQL database is set up as part of Google Cloud SQL fully-managed database service. The following will be covered: Configuration properties in Application.properties Configure POM entries in pom.xml file Configuration properties in Application.properties In application.properties file, while working with Spring Boot app with JPA repository, you need to have following configuration properties in application.properties file. The below assumes that you have a MySQL database with name as dbname and username/password as root/root. In above properties, the instance connection name can be …
Google Recaptcha with Angular and Spring App – Example
In this post, you will learn about how to implement Google Recaptcha with Angular and Spring/Java App. Get Recaptcha code (Key) from Google Angular – Process the Recaptcha code in Login/Sign up Component Spring/Java – RecaptchaVerifier utility class Spring/Java – Verify the Recaptcha Response in Server Side Code Get Recaptcha Code (Secret Keys) from Google Go to Google Recaptcha website and get the code for your website. The Google recaptcha code looks like following: Place the code in appropriate place in login, signup pages. In the login form, it would with code such as following: The Signup form with Google Recaptcha would look like following. The working example can be …
HTTP 403 Error Solution – Access-Control-Allow-Origin
In this post, you will get to know about the Http 403 error, No ‘Access-Control-Allow-Origin’ header, and how to fix this problem. I am currently working with this app, hrXecutive, the recruitment digital assistant. In this app, the front-end is done with Angular 5.* and Backend is done with Spring Boot 2.0.0. It is currently hosted on Google App Engine Standard environment. Although the app is bundled with both Spring Boot and Angular artifacts, in local setup for faster development, I wanted to work independently on both Angular and Spring Boot app. The angular app runs on port 4200 and Spring Boot app runs on port 8080. While trying to invoke an …
Selenium Web Scraping Hello World with Java
Selenium is, primarily, used for automating web applications for testing purposes. However, it could also be used for doing web scraping if required. In this post, you would learn about how to use Selenium for Web Scraping using Java. The following are some of the topics described in this article. Maven project with Selenium Artifact Entry in POM.xml Steps for Writing Web scraping Automation Maven Project with Selenium Artifact Entry in POM.xml Create a Maven Project within your Eclipse IDE and place the following entry in pom.xml file. Get the latest artifacts from Maven Page for Selenium Java page. The above would result in the download of appropriate Java libraries …
Google Cloud Text-to-Speech Java Code Example
Google Cloud Text-to-Speech is a text-to-speech conversion service which got launched a few days back by Google Cloud. This was one of the most important service missing from Google Cloud AI portfolio which is now available and completes the loop for text-to-speech and speech-to-text services by Google Cloud. In next few weeks, you will learn about different usages of Google Cloud text-to-speech service with other Google cloud services. In this post, you will learn about some of the following: Setup Eclipse IDE-based Development Environment Create a Maven or Spring Boot (Spring Starter) Project Setup Eclipse IDE-based Development Environment The following are some of the key aspects of setting up the …
Integrate MailGun with Spring Boot and Java App
In this post, you will learn about integrating your Spring Boot & Java app with MailGun REST API. The following are some of the points covered: Create & Configure/Load MailGun API details MailGun EmailService custom implementation Spring RestTemplate implementation Invoke/Test Email Service Create & Configure/Load MailGun API Details The following represents the Config class used to load the configuration beans by loading the properties from application.properties file. The following represents the code in application.properties file: You could get the above details from MailGun Dashboard. MailGun EmailService Custom Implementation Pay attention to some of the following in the code sample given below: Custom RestClient (Spring RestTemplate) is used for making calls …
Integrate Send Grid with Spring Boot & Java App
In this post, you will learn about integrating your Spring Boot & Java app with SendGrid Web API. The following are some of the points covered: Create & Configure/Load SendGrid API Key Configure SendGrid Maven entry in POM.xml SendGrid EmailService custom implementation Invoke/Test Email Service Create & Configure/Load SendGrid API Key Create an account with SendGrid.com Go to SendGrid Setup Guide using Web API page. Create an API key. Execute the following script in your development environment. Alternatively, you could also configure the SendGrid API key in your application.properties file and read the key details as part of loading configuration beans. The following is the sample code: In the above code …
AWS SNS Example with Spring Boot & Java
Amazon Simple Notification Service (SNS) is a fully managed pub/sub messaging and mobile notifications service for coordinating the delivery of messages to subscribing endpoints and clients. One can get started with Amazon SNS using AWS console or AWS CLI or AWS SDK. One example of how Amazon SNS can be used is the following: Publish a JSON message (consisting of phone no. and message) to Amazon SNS topic Above which will result in triggering an Amazon Lambda function which could in turn trigger Amazon Polly to generate text-to-speech, and, subsequently, invoke Twilio API to make the call to destined phone number. In this post, you will learn about how to …
Spring Boot & Angular 5 PWA Dev Environment Setup
In this post, you will learn about how to quickly create development environment to build an app using Spring Boot and Angular 5. Angular 5 app and Spring Boot is deployed as one single unit on Tomcat server. The following points are covered: Create a Spring Boot Spring Starter Project Create an Angular Service Worker Project Modify POM.xml for Copying Angular App Assets Create a deployment script for automated build and deployments Create a Spring Boot Spring Starter Project Within Eclipse IDE, create a Spring Starter Project for sample Spring Boot app. You may download to SpringSuite Tool Suite (STS) from Eclipse marketplace to have options such as Spring starter …
How-to Tutorials for Spring Security OAuth2 & REST API
In this post, I have listed down some of the top pages which I came across while doing exploring implementation for Spring Security OAuth2 for REST APIs based apps. This page will be updated with good links in time. Secure a Spring Boot REST API With JSON Web Token + Reference to Angular Integration This one is very helpful (by-far-the-best) for developers doing Angular App on the client side and Spring Boot app on the server side. Really a great step-by-step tutorial. Kudos to Author, Nouhoun Y. Diarra. Covers some of the following topics. Github project can be found on this page. Configure spring security Configure authorization server Configure resource server …
Elasticsearch Interview Questions & Answers – Set 1
In this post, you will learn about fundamentals and best practices with ElasticSearch based on the following: Revision notes on Elasticsearch fundamentals A set of questions to test your knowledge and, in turn, help you learn Elasticsearch concepts related to index and shards; These questions could as well help you prepare for interviews related to ElasticSearch A set of interview questions ElasticSearch Fundamentals – Revision Notes Each Elasticsearch shard is a Lucene index The number of shards and replicas can be defined per index at the time of creation of the index. The number of replicas per shard can later be changed. Shard in ElasticSearch is primarily a Lucene index …
How to Create AWS Lambda Deployment Jar using Maven
One of the key aspects of AWS Lambda Function in Java is creating deployment package (jar or zip file) for uploading/deploying on AWS Lambda service. In this post, you will learn about different ways in which you could create a Deployment Jar file for deploying it as AWS Lambda project using Maven. The following are different ways: Deployment jar using Maven and Eclipse IDE Deployment jar using Maven and command prompt I recommend using Maven and commmand prompt technique for creating deployment jar package. Before getting started, download AWS Toolkit for Eclipse from Eclipse Marketplace. Here is the information on getting setup with AWS Toolkit for Eclipse Deployment jar using …
ElasticSearch Create, Query, Delete Index – Java Example
ElasticSearch Java APIs can be used to create, update, query (retrieve items) and delete the index. In this post, you will learn about using Java APIs for performing CRUD operations in relation with managing indices and querying items in ElasticSearch. Create an empty index with data type mapping Create/update the index using BulkRequest APIs Search Index using QueryBuilder and SearchRequestBuilder APIs Delete the index Create an Empty Index with Data-type Mapping Create/Update the Index using BulkRequest APIs Pay attention to some of the following: Create an instance of TransportClient Prepare bulk request for inserting multiple entries in index Delete the Index Pay attention to some of the following: Create an …
ElasticSearch Fuzzy Query Example in Java
ElasticSearch fuzzy query can be used in scenarios when the user searches with mistyped keywords or misspellings. Alternatively, it can also be used for performing the search for similar words based on Levenshtein Edit Distance, which can be defined as the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other. In this post, Fuzzy Search using ElasticSearch Java API is demonstrated. Some of the following points are covered: Getting Setup with ElasticSearch and Kibana ElasticSearch Library POM Entries Using Fuzzy Query API for fuzzy search Using Match Query API for fuzzy search Using Bool Query API for Fuzzy Search Getting Setup with …
Spring Boot JPA MySQL Sample App – Code Example
Creating a Spring Boot app with MySQL data source is something every Java developer come across when thinking of creating a quick POC or app. This post is aimed to provide quick code samples which can be used to quickly create a MySQL-based Spring boot app. In this post, you will learn about code examples in relation to getting setup with Spring Boot app which interacts with MySQL database. The following are some of the topics covered: Define properties in application.properties file Create/Configure Database-related Beans Create Entity Classes (Domain) Create Database Implementation Classes (DAOs) Define Service Classes for interacting with Data Access Objects Invoke service class from SpringBoot main program …
AWS DynamoDB PutItem Java Example to Create Items
In this post, you will learn about Java code example related to creating an entry in the DynamoDB table using PutItem API. The following are some of the points considered later in this article: Configure Dev Environment with AWS Credentials Update POM.xml or Gradle file to include DynamoDB library Use PutItem API to create an Item in DynamoDB table PutItem API example with Spring Boot app Configure Dev Environment with AWS Credentials Make sure you have configured your dev environment with appropriate Access Key ID and secret access key. You could do that by executing the command such as following: If you have configured it correctly, you should be able …
I found it very helpful. However the differences are not too understandable for me