Atul More

Ranch Hand
+ Follow
since Dec 26, 2016
Atul likes ...
Java jQuery Spring
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
11
Received in last 30 days
1
Total given
6
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Atul More

Hi,

A simple questions I have:

I created a rest service using Spring RestController. When multiple request comes to access this service, how many instances are created for my RestController class?
Options:
A. Single instance created(as spring beans are by default singleton) ans used by threads one by one
B. For each request a new instance created.

Thanks,
Atul
4 days ago
Hi,

I found the solution.
I missed the configuration which helps spring security to create and wire up a filter in front of all security infrastructure to look for active sessions and populate the security context from values stored in Redis.
I need to add a class.

SessionConfig.java


After adding this, everything is working as expected.


Thanks,
Atul
2 weeks ago
Hi,

I am integrating Spring session using redis and spring security. I am able to integrate it and removed all the errors which I faced.
But as per the requirement I am not able to get the SESSION attribute in cookie.
I am integrating it with my web application using xml and annotations.

The redis is installed on Windows.

Here is the code:

pom.xml


web.xml


applicationContext-session.xml


RedisSessionAction.java


With the above configuration, the application is running. Even on console it prints activity related to spring session and redis but it is not showing any SESSION attribute in cookie as well as on the redis where there is no key store related to it.

Can somebody help me to figure out what am I missing?


Thanks,
Atul
2 weeks ago
Hi,

Have you tried Spring Session. It might help you.
It supports the distributed mechanism.

Thanks,
Atul
3 weeks ago
Hello Piet and Norm,

Sorry, It was my mistake that I stated the wrong output.

The expectation is to replace the exact match with space from the given string input and return the remaining statement.
E.g. - if the user input is:

What is a coding

then find the exact matching string in a array of data and replace the exact match content.
I thins case

What is a

matched with user input and it is replaced by space. So it just return

coding

as a final result.

Once again sorry for confusion.

Thanks,
Atul
1 month ago

Piet Souris wrote:

Atul More wrote:(...)
This code return me "What is a", which is expected.


Are you sure? I do not expect this outcome.

Put some .peek(System.out::println) in your code, so that you can follow what Strings survive the filter and how they are changed.



Hi Piet,

It is working as I said, I need to keep the data in the manner which supports the functionality.
I have tested it with my test utility and its working with the cases which I have.

Yes, you are right, if the data is not align properly like in descending order and length of the string, it will fail.

Thanks,
Atul
1 month ago
Hi,

I am able to solve it.
Few things I need to follow but it helps me to achieve what I am looking for.
The things I need to follow like:
1. The array of data need to be sorted in desc order based on content and length.
2. Use findFirst method

The solution is:


This code return me "What is a", which is expected.

Thanks,
Atul
1 month ago
Hi,

I have a code and I want to find out the most exact match string.



So it should return me "What is a".

The code I have return me multiple statements.
Can somebody help me.


Thanks,
Atul
1 month ago
Spring framework, Security, Web, Rest, Social, Integration, Test, Boot, Orm.
I have used Spring in almost all the projects.
At few points it is the good option like Security, Rest. Easy configurations with extensive functionality and use.
2 months ago
Hi,

Follow this URL, might be it will help you.

Spring Junit Test

Thanks,
Atul
2 months ago
Thank you Camplbell for your inputs.
2 months ago
Hi Campbell,

Thanks for pointers.
I am searching on the internet and found this java class. Which allow me to read a file. Also allow me to start from a position where I left last time.

RandomAccessFile

As I mentioned earlier as well, I need to read the file again but I dont want to read it from the beginning but from the position where I left earlier.

Thanks,
Atul
2 months ago
Hi,

How can I read a file (E.g.- log file) periodically which is updating continuously.
Lets say I started reading file. After 1 minute again I came and read a file again.
But here I want to read a file from the next where I left.
How can I achieve this?
Is Java classes allow me to read a file from in between?

I am not looking for code but a pointers like how can I achieve this? What things I need to look at if I will go for complete implementation.

Thanks,
Atul
2 months ago
If you'd like to stay with that architecture for some more time, consider using a custom interceptor (based on SpringBeanAutowiringInterceptor source code if you like) managing a local ApplicationContext, possibly in interaction with an EJB 3.1 @Singleton, or a CDI-Spring bridge instead.
2 months ago
HI,

You need to mention spring mvc ralated mapping in web.xml and create the mvc xml file which contains the required bean definitions.

Atul
2 months ago