Getting an EhCache instance with Spring… intelligently

前端 未结 4 1811
情深已故
情深已故 2020-12-09 00:29

I need to get a specific EhCache instance by name and I\'d prefer to autowire if possible. Given the following automatically configured controller, how can I autowire in the

4条回答
  •  爱一瞬间的悲伤
    2020-12-09 01:07

    You can also use autowire if the context can find a bean with the correct class. Here is how I configured my xml

    
        
            WEB-INF/ehcache.xml
        
    
    
    
                  
    
    

    And my java class

    @Autowired
    private net.sf.ehcache.Cache cache;
    

    This setup works for me.

提交回复
热议问题