Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

@Resource annotaion in Spring

@Resource annotation allows you to specify a name of the injected bean. @Resource annotation takes a 'name' attribute which will be treated as the bean name we want to inject in the class. In other words we can say, it follows by-name autowiring ...

BeanPostProcessor in Spring

BeanPostProcessor :- It is an interface that defines callback methods by which you can provide your own instantiation logic and your own custom logic before and after the bean creation. along with this you can perform some additional logic or y...

depends-on attributes in spring

dependsOn attribute for loading the depended beans referenced by another bean. dependsOn is a bean tag that can indicate bean depends on another bean . In this Example we can see when ApplicationContext Container is initialize first it...

How to use Autowire With Qualifiers?

In Spring we use @Qualifier to indicate which bean we want to qualify to autowired on a field. when we create multiple beans of the same type( for example: Department) and want to autowire only one of them with a property in some other class (...

XML Configuration based spring framework example

Hello guys Bellow example will help you to develop XML configuration based spring framework project,here I have develop example to display "Hello Bhagwan" message using beans. Please create project and follow bellow setps: Step :1 Add ...

How to use Filters to Customize Scanning?

In Spring context XML file, Filter has a sub-element 'context:include-filter' having two attributes as 'type' and 'expression' attributes that indicate to Spring container that 'type' is of regular expression whose value is been provided by expre...

How to exclude a bean from auto-wiring?

When configuring beans in configuration file, set the "autowire-candidate" attribute of the bean element in .xml file to false, by doing this the container will exclude that specific bean from auto-wiring. By using the below example we can eas...

How to Generate Excel file using Apache POI in java

Hello Guys Bellow code will help you to generate excel file in java. Herebelow I have used apache poi jar file version: poi3.8.jar . You can download jar file from given bellow link http://poi.apache.org/download.html Now Create ExcelExa...

How to display location on Google Map in JSP in JAVA?

Sometimes we need to display Google Map on a JSP page, for this you just need pass lat/long to JSP. Use below code to initialize map in script: var marker = null; var map = null; var markers = []; function initial...

How to get aspect ratio of an Image in java?

Sometimes we need to get aspect ratio for an image in Java to fulfil our requirement. You can use the below code to get aspect ratio for an image in Java very easily: Define the dimension boundary of which you want resized image as below ( h...

Solution for MDM Error SIP-11008 and SIP-11141

If you are facing an error while executing batch for staging process in MDM Hub (Error executing job: SIP-11008, SIP-11141) Error Description : SIP-11008 :Failed running Cleanse: com.siperian.mrm.cleanse.api.CleanseException: SIP-11141: Excep...

Running Shell Script using java program on ubuntu

Hello guys; The bellow code will help you to write the Java code to pass argument in shell script and execute shell script on ubuntu. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public cl...

Simple Image resizing example in Java

Sometimes we need to resize image in Java to fulfil our requirement. You can use the below code to resize image in Java very easily: Define the dimension boundary of which you want resized image as below Dimension boundary = new Dimensi...

Send Push Notification to iPhone device from Java Server Side

This blog will help you to send Push Notifications to iPhone devices from server side where server side code is written in Java. Follow the below code in order to send Push Notification: Define the below dependency in you pom.xml, if you...

Encript and Decript Data Using with BASE64Encoder and BASE64Decoder

Below written code will be Encrypt and Decrypt Data.This program having used Base64 Encoding which is commonly used in a number of applications including email via MIME, and storing complex data in XML. import java.net.URLDecoder; import ...

Reading CSV File from Apache Commons IO Library

Apache FileUtils class provides General file manipulation utilities, All the methods in this class that read a stream are buffered internally. This means that there is no cause to use a BufferedInputStream or BufferedReader. Below written code...

Hadoop Mapper Utility Class

In example I am going to demonstrate how to load a file from Hadoop Distributed Cache. Here I am writing Mapper and Driver class, inside of Mapper class we have define input type key vale pairs and output type key value pairs. Inside driver c...

What is MDM?

MDM (Master Data Management), it has the object to provide data processing, data collection, matching information, data consolidation, data quality assuring and distribution data throughout organisation and have proper control on data maintenance...

Hibernate One to Many Mapping

One to many mapping One-to-many mapping means a mapping in which each record in one table is linked to multiple records in another table. Like a parent record in one table can have several child records in another table.The parent is not requi...

Comparative Study on HashTable HashMap and HashSet

Hashtable This class has implemented Map interface, before using this data structure you should know their internal implementation Hashtable Class Decleration- <p>Public class Hashtable<k,v> implements Map<k,v> Yo...

Hibernate One to One Mapping

Basic Hibernate Mapping: One to one mapping One to one mapping is performed by one-to-one element. No foreign key is created in primary table. Let us see one simple example, in which we are using bidirectional association. There ar...

Static Import in Java

INTRODUCTION: Static import in Java allows to import static members of class and use them, as they are declared in the same class, means access any static member of class directly without using class name. Like regular import statements, stati...

Autoboxing & Unboxing in Java

INTRODUCTION: The automatic conversion made by the Java compiler between primitive types and their corresponding object wrapper classes, is known as Autoboxing It allows us to use primitive and object type interchangeably in Java on many p...

Get current location on load of a page using google map API

A code snippet for getting current location on browser using google map API Here we are calling getLocation() on load of the page getLocation(); function getLocation() { if (navigator.geolocation) { n...

6 useful code chunks for java coders.

Convert Java util.Date to sql.Date This piece of code shows how to convert a java util Date into a sql Date for use in database. java.util.Date util_date = new java.util.Date(); java.sql.Date sql_date = new java.sql.Date(util_date.getT...

How to run sql queries using JSTL

Run sql queries using SQL tag in JSP We can run SQL queries directly in JSP page using "sql" tag. Suppose we have a 'postgres' database, with below credentials: db:'test' user: root password: 123 table name: user which have a column 'us...

Enumeration in Java

INTRODUCTION An enum type in Java is a special data type that is defined whenever you need to define a variable with a set of predefined values such as Days of the Week, Months of the Year, items in a menu, etc. KEY POINTS ABOUT ENUM ...

What is servlet ?

Servlet is very powerful server side scripting language. It is a class which basically handle network request-response model. It is very powerful as we had earlier like CGI. Basic Request-Rsponse Model When browser send http request to jav...

Multithreading in Java

Multithreading is the process of running two or more threads executing altogether within a single program in Java. Before understanding this let me first explain what threads exactly are. A thread is a light-weight process that runs independen...

Quartz +Spring Integration

It seems today every application needs background jobs, here we are going to learn how to integrate Quartz Scheduler with Spring. Version we are using Spring 3.x Quartz 1.8.6 Maven 3 we have to follow few steps for configure qua...

Marshalling and Unmarshalling in Java

JAXB is Java Architecture for XML Binding which allows to map Java objects to XML and XML to Java objects. Marshalling example : Converting a Java object into a XML file. import java.io.File; import javax.xml.bind.JAXBContext...

Calculate the distance between two locations through HQL in Java

Sometimes we need to calculate the distance between two locations. And to save the time of iteration we can get filtered results through query by apply functionality of calculating distance in the query. Suppose we have two tables Events and ...

Implements Runnable Vs extends Thread in java

Implements Runnable Vs extends Thread in java There are two ways by which we can create custom java thread class 1. By using Runnable interface (implements Runnable) 2. Extending Thread class (extends Thread) I read a statement for T...

Inheritance in Hibernate

Sometimes we need to apply inheritance in Hibernate as per our requirement. Here I'm explaining the Hibernate Inheritance using "Table per subclass: using a discriminator". Suppose we've a class User with subclass Student. And in this approach...

Spring 3 MVC configuration.

Introduction to Spring 3 MVC Framework The Spring web MVC framework provides model-view-controller architecture and ready components that can be used to develop flexible and loosely coupled web applications. The MVC pattern allow us in separa...

Getting coming sunday from current date in Java

To get the coming Sunday from the current date or specified date, write the following code: public static Date getNearestWeekend(Date date) { try { Calendar c = Calendar.getInstance(); Calendar cal1 = Calendar.getInstan...

Getting distance between two locations by lat/long

You will get distance between two location easily by using below code. You will just need lat/long of both location for which you have to calculate distance. /** * Get distance of location between two locations * @param lat2 * @param lon...

To add pause/stop functionality on mouse hover using easySlider1.7

To add pause/stop functionality on mouse hover using easySlider1.7 Step 1: Open easySlider JS file in editor like notepad, notepad++ etc. Step 2: Go to line number 56, and add below bold marked line. continuous: false, numeric: ...

Getting address and city from lot/long in Java

This blog will help you in getting geographical information of any location by using latitude/longitude. By using Java API Geocoder, it is easy to get geographical information of any location. The response will be in JSON or XML format. Wri...

Access restriction: not accessible due to restriction on required library

When i was working on a class i have got the following error.. Access restriction: The type BASE64Encoder is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar I resolved it by looking up on google, ...

Valid main methods in java

main() method in Java the main method in java is the first entry point of the program and the most familiar structures in the Java language. Following are some valid main() signatures in java: //Most common form of main method publi...

Can I use an enum type in Java switch statement?

The Answer to this question is yes, we can use enum in java with switch statement. the following examle shows how: enum Car{THAR,XUV,SCORPIO} class Cars { Car car; Cars(Car car) { this.car= car; } ...

Enum with a main method in java

Enum In java In java we use of enum is not confined to declaring set of constants , introduced in J2SE 5.0, is useful when you want a variable to hold only a predetermined set of values. Just like a class, an enum can have constructors, m...

How can you Create a inner class inside a method

In java can we create a inner class inside a method?? Answer to this query is yes . Example code : class Outer { String outerVar="outer Variable"; public void checkInner() { final Strin...

How to use variable Argument in java

How to use variable argument Using variable argument in java method can be very important tool . As we can give multiple no of inputs to the methods using variable argument. The rules to define variable-length parameters in a metho...

How to use for each in java

Using for each In place of Normal loops in java for each can be used to display the all the elements of the array. Syntax : for(datatype variablename : array) { // Do the work with varialble } example publi...

Getting weekends date in Java

To get weekend list for a current year, write the following code: private ArrayList weekendList = null; public void findWeekendsList() { weekendList = new ArrayList(); Calendar calendar = null; calendar = Calendar.getInstance(...

Polymorphism Java

Polymorphism in Java OOP's a very important jargon in the programming world, and many of us are familiar with this word, Object oriented Programming. Polymorphism is a main pillar of OOP,s by definition it is the ability of an object to t...

Maven build issue due to -jre or jdk

Error after running Maven install Error: Unable to locate the Javac Compiler in: C:\Program Files (x86)\Java\jre6..\lib\tools.jar Please ensure you are using JDK 1.4 or above and not a JRE (the com.sun.tools.javac.Main class is required)....

Getting ZipCode from lat/long in android

This blog will help you in getting geographical information of any location by using latitude/longitude. By using Java API Geocoder, it is easy to get geographical information of any location. The response will be in JSON or XML format. Wri...
1 12
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: