Skip to content

Commit

Permalink
Another injection fix
Browse files Browse the repository at this point in the history
  • Loading branch information
torshid committed May 23, 2023
1 parent ccfbaa1 commit 154183a
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.turkraft.springfilter.boot;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
Expand All @@ -17,11 +18,15 @@ public class FilterConversionServiceConfiguration {
@Nullable
protected final ConversionService defaultConversionService;

protected final List<ConversionService> conversionServices;

public FilterConversionServiceConfiguration(
@Nullable @Autowired(required = false) @Qualifier("mvcConversionService") ConversionService mvcConversionService,
@Nullable @Autowired(required = false) @Qualifier("defaultConversionService") ConversionService defaultConversionService) {
@Nullable @Autowired(required = false) @Qualifier("defaultConversionService") ConversionService defaultConversionService,
@Nullable @Autowired(required = false) List<ConversionService> conversionServices) {
this.mvcConversionService = mvcConversionService;
this.defaultConversionService = defaultConversionService;
this.conversionServices = conversionServices;
}

@Bean
Expand All @@ -32,6 +37,9 @@ public ConversionService sfConversionService() {
if (mvcConversionService != null) {
return mvcConversionService;
}
if (conversionServices != null && !conversionServices.isEmpty()) {
return conversionServices.get(0);
}
throw new IllegalArgumentException("Could not find any ConversionService bean!");
}

Expand Down

0 comments on commit 154183a

Please sign in to comment.