Arun Singh Raaj

Ranch Hand
+ Follow
since Jan 30, 2017
Cows and Likes
Cows
Total received
2
In last 30 days
0
Total given
0
Likes
Total received
4
Received in last 30 days
0
Total given
120
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arun Singh Raaj

1. singleton(default*)
2. prototype
3. request
4. session
5. global session

As there are 5 types of scopes a bean can have, I know how different they are but I want to know what bean scope is used in real web application projects. So please tell what scope for a bean you had decided to use while developing the applications.

Thanks in advance.
1 year ago
Hi experts,
May i know how do the microservices of an application communicate with each other? I saw some examples on internet, it uses some rest clients like RestTemplate/WebCLient/Feign.
It seems these rest-clients are just for practice purpose while real microservices based applications use something else like RabbitMQ etc. May I know your opinion on this?

I would also like to know:
When every microservice has its separate db then how does the linking between the tables of separate DBs like one-to-many, many-to-many work?


Thanks in advance.
1 year ago
If developers are using postman to test the rest ws then the real controller is going to accept the request that further passes the request to Service and Data Layer. Then how is it called a unit test? Are developers responsible for performing such integration tests or it's job of the testers?

What I thought developer's job is, using MockMvc to create the HTTP calls and mock service classes within the test class itself and perform the unit testing of controllers.

Please shed some light on it.
Thanks in advance.
1 year ago
Hi, it's really confusing to understand whether a real HTTP request is sent to the controller or test-controller in case of using spring's MockMVC instance while testing the Controller classes in a java based web application. Please share your experience.
Thanks.
1 year ago

Campbell Ritchie wrote:Please remind yourself of that old discussion first. I thought we had answered all your questions there.

Yes I do remember and I'm grateful to you all.

As for a HashMap, how do you know that it uses trees at all?

Yes, RBT isn't mentioned in java-docs of HashMap but wiki page of RBT and implementation page of HashMap given by Josh Bloch (I don't know how official this page is) do talk about it.

If HashMap really uses RBT to store entries in a bucket then the number of entries referenced to a single bucket are sorted, that's the reason of using RBT over linked-list so that search operation is improved from O(n) to O(log n). Isn't it?
1 year ago
Red black trees always store elements in sorted order so TreeMap uses the RBT to store entries in buckets. HashMap too uses RBT then why HashMap isn't sorted?

Thanks.
1 year ago
When you import existing project in intelliJ, it doesn't create a file system in workspace directory, instead it just creates an .idea folder having some xml files.
In Eclipse IDE when you import existing spring boot maven project then it copies the file system into workspace.
Please let me know how to enable it in intelliJ.
Thanks.
1 year ago
Do developers not use Second-level cache of hibernate?
Hi, I read in tutorials that the caching works only for session methods ie get(), load() plus HQL queries which do find by IDs.

I want to know that queries that retrieve all records from db like "select * from employee", the results of such queries are not cached?
If it can be cached then how?

Thanks.
In case of an HTML form, you can bind the form-fields data to List<Employee> at Controller :
but how to bind employee data using postman? It throws exception when you POST JSON data in postman, it doesn't receive List of Employee at controller. Please help to fix it.
Thanks.
1 year ago

Campbell Ritchie wrote:Note that previous and next fields in the nodes are accessible because they are private fields in nested classes. As you can see, the linked list has nodes which can be accessed from each other.

Yes, I get it!
It's easy but I took much time to understand.
LinkedHashMap.Entry has two additional fields:
(package private) LinkedHashMap.Entry<K,V> after
(package private) LinkedHashMap.Entry<K,V> before
These two fields record the insertion order. The picture makes it more clear.
1 year ago
Thanks for the info.

Campbell Ritchie wrote:This is how an array list works, grossly simplified. This is similar to the actual implementation, but not exactly the same.

I get it!

I should've asked you about only LinkedList and HashMap. As I've read somewhere, the linked-list of nodes in HashMap (Java 8)is converted into Red-black tree when it exceeds 8 elements so it still does have linked-list.
Anyway, I want to know in context of Java 7. How does insertion order is preserved in LinkedList and why it couldn't preserve in HashMap. It would be a great help if you respond. Thanks.
1 year ago
I searched but could not understand what implementation of linked-list data-structure makes LinkedList preserve insertion order and why it is not the same for HashMap despite HashMap uses linked-list data structure for nodes.

Thanks in advance.
1 year ago
Hi, if ArrayList/LinkedList have 10 as default size then why does it throw IndexOutOfBoundsException when you insert some value at given index in an empty List:
1 year ago