@Autowired
private MediaService mediaService;
@Primary
@Service
public class MediaServiceImpl implements MediaService
service有多个实现类的时候,注入的时候需要按照@Qualifier() 注入,
加了@Primary 可以实现一个默认的注入类
@Primary is an effective way to use autowiring by type with several instances when one primary candidate can be determined. When you need more control over the selection process, you can use Spring’s @Qualifier annotation. You can associate qualifier values with specific arguments, narrowing the set of type matches so that a specific bean is chosen for each argument. In the simplest case, this can be a plain descriptive value, as shown in the following example: