tag:blogger.com,1999:blog-67916261482827534612024-02-19T08:10:40.698+05:30Educate JavaJava Education SiteChandrahttp://www.blogger.com/profile/01209478501446255220noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-6791626148282753461.post-14557106863801075082020-08-24T16:21:00.007+05:302020-08-24T16:23:13.361+05:30Conditional Beans in spring boot applicationIntroduction
As per spring-boot documentation, auto-configuration is implemented with standard @Configuration classes. Additional @Conditional annotations are used to constrain when the auto-configuration should apply. Usually, auto-configuration classes use @ConditionalOnClass and @ConditionalOnMissingBean annotations. This ensures that auto-configuration applies only when relevant classes are Chandrahttp://www.blogger.com/profile/01209478501446255220noreply@blogger.com0tag:blogger.com,1999:blog-6791626148282753461.post-67974131341245015142020-08-05T15:30:00.013+05:302021-12-15T14:54:20.799+05:30How to Change the Default Server Port in Spring-bootIntroduction
Spring Boot initial project (which is generated from spring starter) project comes with an embedded server i.e tomcat. The default port of embedded tomcat is 8080. Changing the default port for the embedded server has multiple ways. Let's find out how.
Using property files
The easiest way to customize Spring Boot embedded server port is by overriding the values of the default Chandrahttp://www.blogger.com/profile/01209478501446255220noreply@blogger.com0tag:blogger.com,1999:blog-6791626148282753461.post-12998794763165445572020-08-04T09:24:00.010+05:302021-12-15T14:55:07.759+05:30How to disable banner in spring bootIntroduction:
When your spring-boot application starts, you should see something similar to the following output (Banner):
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: Chandrahttp://www.blogger.com/profile/01209478501446255220noreply@blogger.com0tag:blogger.com,1999:blog-6791626148282753461.post-44110941463063565912020-05-20T13:20:00.009+05:302020-08-02T14:30:53.060+05:30Why String and wrapper classes are immutable and final in java
Introduction:
Immutable objects are, objects whose state (data) cannot change after construction. String and Wrapper classes in java are immutable. (refer this link for more details)
Immutable objects simplify the program based on below:
They are simple to construct, test and use.
They are automatically thread-safe and won't face synchronization issues.
They don't need a copy constructorEducate Javahttp://www.blogger.com/profile/08927732260599435686noreply@blogger.com0tag:blogger.com,1999:blog-6791626148282753461.post-75427367581220314532016-05-01T00:55:00.002+05:302020-08-24T16:25:19.966+05:30Why do we need to override the equals and hashcode methods in java
Introduction:
When we need to use our object in the hashing based collections, we must override both equals() and hashCode() methods.
We must override hashCode() in every class that overrides equals(). Failure to do so will result in a violation of the general contract for Object.hashCode(), which will prevent your class from functioning properly in conjunction with all hash-based collections,Educate Javahttp://www.blogger.com/profile/08927732260599435686noreply@blogger.com0tag:blogger.com,1999:blog-6791626148282753461.post-14588730352975387272016-03-15T22:20:00.002+05:302020-08-24T14:15:39.902+05:30Copying object in java
Let us Assume an object- obj1, that contains two objects, containedObj1 and containedObj2.
shallow copying:
shallow copying creates a new instance of the same class and copies all the fields to the new instance and returns it. Object class provides a clone method and provides support for the shallow copying.
Deep copying:
A deep copy occurs when an object is copied along with the objects toEducate Javahttp://www.blogger.com/profile/08927732260599435686noreply@blogger.com0tag:blogger.com,1999:blog-6791626148282753461.post-38623541172057200372016-03-15T00:28:00.000+05:302016-05-09T02:11:13.350+05:30Differences and Similarities between HashSet TreeSet and LinkedHashSet
Introduction:
TreeSet, LinkedHashSet and HashSet are implementation of Set interface from that, they follows contract of Set interface i.e. they do not allow duplicate elements.
Now in this post we will see the difference between HashSet, TreeSet and LinkedHashSet on different points like ordering elements, allowing null and performance ..etc.
Details of HashSet TreeSet and LinkedHashSet:
Chandrahttp://www.blogger.com/profile/01209478501446255220noreply@blogger.com0tag:blogger.com,1999:blog-6791626148282753461.post-31283671229128841312016-03-05T05:51:00.003+05:302021-07-11T12:50:50.303+05:30Configuring two way SSL in Tomcat
Setting up Tomcat to provide self-signed SSL certificates allowing
secure client/server communication and relatively easy to set up. Java provides a handy command-line tool called keytool that you can use to generate keystores.
Generate the Client and Server Keystores :
By following the instructions below, you will create two keystores:
clientkeystore.jks (for the client to use) Chandrahttp://www.blogger.com/profile/01209478501446255220noreply@blogger.com0tag:blogger.com,1999:blog-6791626148282753461.post-19832973344667302412016-02-29T05:45:00.007+05:302020-08-09T23:56:02.048+05:30How to re-load properties files without restarting server in java
Re-load properties files without restarting server in Java:
Restart an application-server (servlet-container) means restart all the web-apps that are running under that application-server, with
resulting unavailability of services. For this we’ll use the Java class PropertiesConfiguration available in the Apache Common Configuration library. This class allow to bind properties file to a&Chandrahttp://www.blogger.com/profile/01209478501446255220noreply@blogger.com0tag:blogger.com,1999:blog-6791626148282753461.post-54751862917758182142016-01-05T09:40:00.000+05:302020-05-10T14:48:28.266+05:30Remove duplicate elements in an Array
package com.test.blogger;
/**
* @author EducateJava
*/
public class RemoveDuplicatesFromArray {
public static void main(final String[] args) {
final RemoveDuplicatesFromArray removeDuplicatesFromArray = new RemoveDuplicatesFromArray();
final String[] finalArray = removeDuplicatesFromArray
.removeDup(new String[] { "1", "one", "1", "three", "two", "2", "three", "1" });
for (final Educate Javahttp://www.blogger.com/profile/08927732260599435686noreply@blogger.com0tag:blogger.com,1999:blog-6791626148282753461.post-61076490040872682012016-01-01T10:00:00.003+05:302020-08-02T04:02:25.173+05:30Java Transient and Volatile Keywords
Transient Keyword:
Transient Keyword marks a member variable not to be serialized when
it is persisted to streams of bytes. When an object is transferred
through the network, the object needs to be ‘serialized’. Serialization
converts the object state to serial bytes. Those bytes are sent over the
network and the object is recreated from those bytes. Member variables
marked by the Chandrahttp://www.blogger.com/profile/01209478501446255220noreply@blogger.com0