File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -370,6 +370,8 @@ static class LikeParameterBinding extends ParameterBinding {
370370 private static final List <Type > SUPPORTED_TYPES = Arrays .asList (Type .CONTAINING , Type .STARTING_WITH ,
371371 Type .ENDING_WITH , Type .LIKE );
372372
373+ private static final String PERCENT = "%" ;
374+
373375 private final Type type ;
374376
375377 /**
@@ -464,15 +466,15 @@ static Type getLikeTypeFrom(String expression) {
464466
465467 Assert .hasText (expression , "Expression must not be null or empty" );
466468
467- if (expression .matches ( "%.*%" )) {
469+ if (expression .startsWith ( PERCENT ) && expression . endsWith ( PERCENT )) {
468470 return Type .CONTAINING ;
469471 }
470472
471- if (expression .startsWith ("%" )) {
473+ if (expression .startsWith (PERCENT )) {
472474 return Type .ENDING_WITH ;
473475 }
474476
475- if (expression .endsWith ("%" )) {
477+ if (expression .endsWith (PERCENT )) {
476478 return Type .STARTING_WITH ;
477479 }
478480
You can’t perform that action at this time.
0 commit comments