NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
## 一、概述 非静态的特别简单,不用多说了; ## 二、方案 ### **方案1** ``` @Component public class ApiFacade { private static CardSourceDao CardSourceDao; private static CardSourceThirdPartyDao CardSourceThirdPartyDao; @Autowired public void setComponent(CardSourceDao CardSourceDao, CardSourceThirdPartyDao CardSourceThirdPartyDao) { ApiFacade.CardSourceDao = CardSourceDao; ApiFacade.CardSourceThirdPartyDao = CardSourceThirdPartyDao; } ``` ### **方案2** ``` @Autowired private GlobalProperties globalProperties; private static GlobalProperties properties = null; @PostConstruct public void init() { properties = globalProperties; } ```