Middleware becomes increasingly important in building distributed applications. Conventional middleware systems are designed, implemented, and packaged before applications are developed accordingly. We argue that this paradigm of middleware construction is problematic in terms of application specific customizations. We propose to reverse this conventional paradigm by allowing user applications determine the constituents of a particular middleware implementation. We term this type of post-postulated middleware as Just-in-time middleware (JiM). We first describe the key ingredients of JiM: acquisition, targeting,and synthesis. We then present Abacus, a JiM implementation based on the aspect oriented refactoring of legacy middleware. In addition, we present Arachne, the Abacus synthesizer, which integrates the source analysis, the feature inference, and the implementation synthesis. Our evaluation show that, completely through automatic synthesis, Abacus is able to support diversified...