开发者

Instantiate Bean/Service with Spring IoC

With Java-APNS, they create a service like this:

 ApnsService service = APNS.newService()
     .withCert("C:/temp/myCertificate.p12", "p@ssw0rd")
     .withSandboxDestination()
     .build();

ApnsS开发者_运维百科ervice is a Java Interface.

I'd like to instantiate this service with Spring and inject it in another service, any idea?

Best thanks to you!


You may be able to do it in Spring by designating a factory method in the application context for that bean, but it could be tricky. The Bloch builder idiom is not what Spring had in mind.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜