Win a copy of Microservices in Action this week in the Web Services forum!

vinayak shete

+ Follow
since Mar 22, 2017
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by vinayak shete

I am learning REST web services with JAX-RS.

below are the two classes I have written :


I am deploying this WebApp with Tomcat v7.0.

when I trying to access URL: http://localhost:8080/RestAdvance/api/test/t I get 404 error.
Not able to figure out what is going wrong here.
3 weeks ago
I am trying to inject HashMap Object using util namespace but not able to get HashMap class for that Object (LinkedHashMap class name is getting printed.)
Not able to figure out why this is happening.

I am using below Spring jars in this test:
1. spring-beans-5.0.7.RELEASE.jar
2. spring-context-5.0.7.RELEASE.jar
3. spring-core-5.0.7.RELEASE.jar
4. spring-expression-5.0.7.RELEASE.jar
5. commons-logging-1.1.1.jar

1. Bean Class :

2.  Driver class to test the output :

3. xml configuration file :

And the out put I able to see is :

I am expectting It should be HashMap class.

Please help.
3 months ago

Thanks Jeanne Boyarsky

I got the point now. It was due to I didnt Overriden .equals() method.

Below change did the task.

Output is as expected:

>java Test
With Wrapper classes .equals() method working. :
{20=b, 10=a_new}

With user defined classes .equals() method. :
{T@1=b, T@1=a_new}

6 months ago

Thanks Jeanne Boyarsky and Carey Brown.

@Carey Brown. : I have already Override hashCode() method (will return same hash code - as 1 for each object.)
@Jeanne Boyarsky : I have tried with @Override annotation. When I put @Override annotation getting compile time error :

>javac error: method does not override or implement a method from a supertype
1 error

6 months ago
Hi All,

I was testing the concept mentioned in subject line. As I see this seems correct with Wrapper class but not with user-defined class.
My understanding is: While put operation HashMap checks keys with .equeals() (content of key object) method and if it is same it replaces existing Object for that key.
But below program is not confirming this with user-defined class's object.
Please, correct if I am missing something :

Test Code and its Output :


>java Test
With Wrapper classes .equals() method working. :
{20=b, 10=a_new}

With user defined classes .equals() method is not working. :
{T@1=a_new, T@1=b, T@1=a}

6 months ago
When we execute Java program with
>java <class_name>
The JVM instance get created and program get executed in that instance.
So here I want to understand how this JVM instance get created internally?
There are many posts, articles describing internals of JVM and its components but I didn't find anything which explains how exactly the instance of JVM is created.
6 months ago