  On the basis of Usadel equations we investigate
superconductor/ferromagnet/superconductor (S/F/S) hybrid systems which consist
of superconducting nanostructures (spheres, rods) embedded in ferromagnetic
metal. The oscillations of the critical current of the S/F/S Josephson
junctions with the thickness of ferromagnetic spacer between superconducting
electrodes are studied. We demonstrate that the $\pi $ state can be realized in
such structures despite of a dispersion of the distances between different
parts of the electrodes. The transitions between 0 and $\pi $ states at some
thickness of ferromagnetic spacer can be triggered by temperature variation.
