In a component-based system components are basic computation units implementing specific business functions, and their interactions are explicitly represented by connectors. If the system is required to be adaptable with dynamic architectural evolutions, the connectors must have the capability of being adapted at runtime to different interaction context. Aiming at this requirement, we propose an automatic connector generation method in this paper. In the method, connectors are generated on analysis of behavior and data specifications of two components to be assembled. First a state machine for connector behavior is created, and then the connector can be executed on the state machine, data adaptation scheme and predefined stub templates for various component types. Mismatches on data are resolved by model transformation. An example of payment query in ebusiness is referred throughout the paper to illustrate our method.