1、編寫bean類
@Component
@Scope(value = WebApplicationContext.SCOPE_REQUEST,proxyMode= ScopedProxyMode.TARGET_CLASS)
public class CeAuth {
}
注意:scope註釋該bean僅在當前http生命週期內有效
2、配置要註冊到spring的bean
在resources/META-INF/spring.factories文件中配置
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.cecd.sdk.auth.CeAuth,com.cecd.sdk.AppProperties
3、使用時按常用的bean方式調用即可