application-scope

How make an object that's shared across the entire application in play framework (1.x)?

别来无恙 提交于 2019-12-24 05:47:13
问题 I want to make one instance of an object across the entire Play Application. I don't think static will work because Play uses many classloaders to load the same class many times (I confirmed this with a heap analysis). Is there something like InitialContext resources to store and retrieve an object instance across the entire app? 来源: https://stackoverflow.com/questions/37909439/how-make-an-object-thats-shared-across-the-entire-application-in-play-framework

@Injected @ManagedBean gets reinitialized despite of @ApplicationScoped annotation

只谈情不闲聊 提交于 2019-12-08 05:11:10
问题 I am writing a simple JSF application for converting currencies. There is a Rates class which holds the data, Currencies class for managing requests and Manage class for adding new currencies. My problem is: I want the currencies to be persisted as a property of Rates class hence my use of @ApplicationScoped . However I can see that Rates keeps getting reinitialized with every single request . Here's my code of Rates : @ManagedBean @ApplicationScoped public class Rates { private Map<String,

@Injected @ManagedBean gets reinitialized despite of @ApplicationScoped annotation

倖福魔咒の 提交于 2019-12-06 15:45:51
I am writing a simple JSF application for converting currencies. There is a Rates class which holds the data, Currencies class for managing requests and Manage class for adding new currencies. My problem is: I want the currencies to be persisted as a property of Rates class hence my use of @ApplicationScoped . However I can see that Rates keeps getting reinitialized with every single request . Here's my code of Rates : @ManagedBean @ApplicationScoped public class Rates { private Map<String, Double> rates = new HashMap<String, Double>(); private Set<String> currencies = new HashSet<String>(){ {

Utility methods in application scoped bean

心已入冬 提交于 2019-12-05 23:01:08
问题 Do you think it is a good idea to put all widely used utility methods in an application scoped bean? In the current implementation of the application I'm working on, all utility methods (manipulating with Strings, cookies, checking url, checking current page where the user is etc.) are all put in one big request scoped bean and they are referenced from every xhtml page. I couldn't find any information on stackoverflow if the approach of putting utility methods in an application scoped bean

Concurrency of @ApplicationScoped JSF managed beans

江枫思渺然 提交于 2019-11-28 11:29:35
I'm using Mojarra 2.2.12 and in our project we've got a few @ApplicationScoped beans. For instance: @ManagedBean @ApplicationScoped public class AppScopedBean{ private int commonValueForClients; //GET, SET public void evalNew(){ int newCommonVal; //Evaluation of the new value, doesn't depend on the commonValueForClients commonValueForClients = newCommonVal; } } My question is should we worry about visibility of the new assigned value? I couldn't find in the spec that JSF infrastructure must synchronize access to @ApplicationScoped bean fields. So, particularly for Mojarra 2.2.12, should we

Concurrency of @ApplicationScoped JSF managed beans

旧时模样 提交于 2019-11-27 06:17:54
问题 I'm using Mojarra 2.2.12 and in our project we've got a few @ApplicationScoped beans. For instance: @ManagedBean @ApplicationScoped public class AppScopedBean{ private int commonValueForClients; //GET, SET public void evalNew(){ int newCommonVal; //Evaluation of the new value, doesn't depend on the commonValueForClients commonValueForClients = newCommonVal; } } My question is should we worry about visibility of the new assigned value? I couldn't find in the spec that JSF infrastructure must