Author: Arpit Mandliya
- 01 August
How to ping URL and get the status in java
In this post, we will see how to get ping URL and get status of it. We will use HttpURLConnection to connect to url and if response code is not 200, then it is not connected. [crayon-6782adc077909078933521/] When you run above program, you will get below output: [crayon-6782adc077911192629842/]
- 31 July
Spring Restful client – RestTemplate example
In this tutorial, we will see how to create rest client using Spring RestTemplate. We have already seen Spring restful web services crud example. We have used postman utility to demonstrate all HTTP methods such as get, post, delete and put but if you want to write java code for restful client , you can […]
- 29 July
What is default administrator password for Tomcat?
When you want to deploy your application to tomcat server , you may do it using admin UI but how can you access it? Do you know default admin password? Actually tomcat does not provide any default password. You need to add users to $TomcatHome/conf/tomcat-users.xml and provide role as manager-gui(For tomcat 7 and 8) and […]
- 27 July
How to send HTTP request GET/POST in Java
In this post, we will see how to send HTTP Get/Post in java. There are many times when you need to send http get or post request. You can use HttpURLConnection for sending get/post request in java. It belongs to java.net package. HttpURLConnection example: We are going to send get or post request to URLs […]
- 27 July
Prefix “context” for element “context:component-scan” or “context:annotation-config” is not bound : Spring error
When you are working on spring or spring mvc application, you may encounter below error message. org.xml.sax.SAXParseException: The prefix “context” for element “context:component-scan” is not bound . or org.xml.sax.SAXParseException: The prefix “context” for element “context:annotation-config” is not bound . This issue generally occurs when you do not include context namespace. For example: Lets say you have below […]
- 26 July
How to load multiple Spring configuration files
In this post , we will see how to load multiple spring bean configuration files. Sometimes, you have multiple spring bean configuration file , you may have different configuration file for service, different for business object. When you are working on complex application, it is not good practice to have only single xml configuration, you […]
- 25 July
Spring MVC interceptor HandleInterceptorAdapter example
Sometimes you need to intercept incoming request and do some preprocessing or you need to do it after completion of request. It is very much similar to filters that we use with servlet. There are two ways to use interceptor with Spring MVC. Spring MVC tutorial: Spring MVC hello world example Spring MVC Hibernate MySQL […]
- 22 July
Spring AOP AspectJ Annotation Example
In this post, we will see Spring AOP AspectJ Annotation examples. If you are not familiar with Spring AOP terminology, you may go through Spring Aspect oriented programming(AOP) tutorial. Following are the AspectJ annotations which we are going to use to implement Spring AOP. @Aspect : To declare a class as Aspect. Annotations which are […]
- 17 July
How to create custom exception in java
In this post, we will see how to create custom exception in java. It is very simple to create custom exception in java. You just need to extends Exception class to create custom exception. Lets understand this with example. You have list of counties and if You have “USA” in list of country, then you […]