相关疑难解决方法(0)

Spring Singleton螺纹安全

如果我在下面定义了一个通过依赖注入在我的Web应用程序中注入的Java类:

public AccountDao
{
   private NamedParameterJdbcTemplate njt;
   private List<Account> accounts;

   public AccountDao(Datasource ds)
   {
       this.njt = new NamedParameterJdbcTemplate(ds);
       refreshAccounts();
   }

   /*called at creation, and then via API calls to inform service new users have 
     been added to the database by a separate program*/
   public void refreshAccounts()
   {
      this.accounts = /*call to database to get list of accounts*/
   }

   //called by every request to web service
   public boolean isActiveAccount(String accountId)
   {
       Account a = map.get(accountId);
       return a == null ? false …
Run Code Online (Sandbox Code Playgroud)

java spring multithreading

8
推荐指数
1
解决办法
4万
查看次数

标签 统计

java ×1

multithreading ×1

spring ×1