File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
src/main/java/com/somemore/domains Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1212import org .springframework .web .bind .annotation .GetMapping ;
1313import org .springframework .web .bind .annotation .PathVariable ;
1414import org .springframework .web .bind .annotation .RequestMapping ;
15- import org .springframework .web .bind .annotation .RequestParam ;
1615import org .springframework .web .bind .annotation .RestController ;
1716
1817import java .util .UUID ;
Original file line number Diff line number Diff line change 33import org .springframework .context .annotation .Condition ;
44import org .springframework .context .annotation .ConditionContext ;
55import org .springframework .core .type .AnnotatedTypeMetadata ;
6- import org .springframework .util .MultiValueMap ;
6+
7+ import java .util .Objects ;
78
89public class OnElasticSearchEnabledCondition implements Condition {
910
1011 @ Override
1112 public boolean matches (ConditionContext context , AnnotatedTypeMetadata metadata ) {
12- MultiValueMap < String , Object > attrs = metadata .getAllAnnotationAttributes (
13- ConditionalOnElasticSearchEnabled .class .getName ());
14- String propertyName = (String ) attrs . getFirst ( "propertyName" );
15- String havingValue = ( String ) attrs . getFirst ("havingValue" );
13+ String propertyName = ( String ) Objects . requireNonNull ( metadata .getAnnotationAttributes (
14+ ConditionalOnElasticSearchEnabled .class .getName ())). get ( "propertyName" ) ;
15+ String havingValue = (String ) Objects . requireNonNull ( metadata . getAnnotationAttributes (
16+ ConditionalOnElasticSearchEnabled . class . getName ())). get ("havingValue" );
1617
1718 String propertyValue = context .getEnvironment ().getProperty (propertyName );
18- return havingValue .equals (propertyValue );
19+
20+ return havingValue .equals (propertyValue != null ? propertyValue : "" );
1921 }
20- }
22+ }
You can’t perform that action at this time.
0 commit comments