We shall present our theoretical studies of a Josephson junction of small size in a lossless cavity. When the size of two superconductors are at order of micrometres and the Josephson coupling constant is adjusted to the correct magnitude, the Josephson junction is found to be reduced to a two-level system owing to the finite-size effect and the quenching of the low-lying singleelectronic excitations by the superconducting gap. When such a two-level system is placed in a high-quality microwave cavity, the coupling constant with a single photon g may be extremely large, for instance of the order of loR s-'. On the other hand, the damping rate of the cavity field is much less than g. Therefore, this two-level system may be used to study the quantum nature of photons and to control the dynamics of quantum fields in the framework of the Jayne-Cummings model much more easily.