I have Recently started working on Spring Boot. I came to know the feature called Hazelcast.
Can some one please explain me about how the Hazelcast can be used for accessing session and setting session attributes ?
Also it would be great if i can get the information about how the session will be managed.
BestRegards,
Hemal.
Does this help https://github.com/hazelcast/hazelcast-code-samples/tree/master/hazelcast-integration/springboot-http
Disclaimer: I wrote this example.
Related
I'm new to an ongoing project/company and this project is using ThreadLocal to store user session data. It's a Springboot project.
I already know that this is BAD design, but i'm trying to find documentation to explain then why this will probably fail badly when the number of users/requests grow.
Can someone help me with links that explain the relation of Threads and Spring Sessions or provide an explanation on how this is a design flaw?
Trying to figure out how to integrate spring session with an app based on the broadleaf framework and so far it was unsuccessful, tried importing the BroadleafJdbcHttpSessionConfiguration config but it was to no success. Any ideas on how to make it work?
The BroadleafJdbcHttpSessionConfiguration class was added primarily to better support multi-session customer assisted shopping for Customer Service Representatives. The instructions for setting up the BroadleafJdbcHttpSessionConfiguration is in this context. See https://www.broadleafcommerce.com/docs/enterprise/current/multi-customer-assisted-shopping
If you are trying to introduce distributed session management, BroadleafJdbcHttpSessionConfiguration is an option but not recommended. We recommend using Memcached with the Tomcat Session Manager. See https://github.com/magro/memcached-session-manager/wiki/SetupAndConfiguration
The configuration for Memcached and Tomcat Session Manager is pretty easy and it works well.
We are Implementing Mongo based session persistence using SparkJava (version 2.6.0 with Jetty 9.4.x). we required to store jetty session into mongoDB. How i can achieve it in SparkJava? I found many example of using MongoSessionIdManager and MongoSessionManager with jetty-nosql (9.3.x). but MongoSessionIdManager and MongoSessionManager no longer exist in jetty-nosql (9.4.x).
I think this topic was discussed at https://github.com/perwendel/spark/pull/836 but not able to find example of implementation..
Thanks a lot in advance !!
I Got it working after customizing SparkJava library and generated spark-core-2.6.1-SNAPSHOT.jar.
added working Example of MongoDB and JDBC based session clustering using SpakrJava at My GitHub repository
I am developing a java web application in which I want to cache all the data present in a table during server start up.
Also if there are any changes in DB values, I wish to refresh the cache (without restarting the server).
I am looking for some material in spring which may help me in achieving that. But I am not able to figure it out.
Please help how can I achieve the same. Also I would like to initialize some beans on server start up.
To start with read the following docs which will get you started.
Refer to Spring document http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/cache.html
Also check this simple tutorial http://viralpatel.net/blogs/cache-support-spring-3-1-m1/
Regarding your bean initialization you can use #PostConstruct annotation on a method of the bean class. Spring will call that method after the bean is constructed.
The application that your planning to build wouldnt be an easy one. In my experience, creating an application like that would require a knowledge of the following:
1. Spring
2. Ehcache
3. JMX
4. Servlet Listeners
I would need to implement an audit log for a web application written with JBoss Seam. EntityListeners seem like good candidates, but I don't know how to connect the EntityListeners to the application session context to include the logged in used principal in the audit record.
I wonder if there is a way to do this "connection", or if there is a more confortable/elegant/effective way to implement an audit log for this programming environment.
Thanks in advance.
Rafa.
Edit:
Many thanks to Damo for his answer! I tried the injection of my identity component, but it did not work. However, the suggested call to Component.getInstance() did provide the desired reference to the user's identity in the EntityListener.
Have you tried injecting your Application/Session scoped Beans into the EntityListener? Or using Component.getInstance("myBean") if injection is unavailable.