Dynamically filters JPA entities with a simple query syntax. Provides JPA/Hibernate predicates and Spring Data specifications.

Overview

Spring Filter

You need a way to dynamically filter entities without any effort? Just add me to your pom.xml. Your API will gain a full featured search functionality. You don't work with APIs? No problem, you may still not want to mess with SQL, JPA predicates, security, and all of that I guess. From a technical point of view, I compile a simple syntax to JPA predicates.

Example

/search?filter= average(ratings) > 4.5 and brand.name in ('audi', 'land rover') and (year > 2018 or km < 50000) and color : 'white' and accidents is empty

You may also apply sorting using sort, for example: &sort=name,-brand.id (where - means descending)

/* Entity used in the query above */
@Entity public class Car {
  @Id long id;
      int year;
      int km;
  @Enumerated Color color;
  @ManyToOne Brand brand;
  @OneToMany List<Accident> accidents;
  @ElementCollection List<Integer> ratings;
  // ...
}

🚀 Yes we support booleans, dates, enums, functions, and even relations! Need something else? Tell us here.

Installation

<dependency>
    <groupId>com.turkraft</groupId>
    <artifactId>spring-filter</artifactId>
    <version>0.9.3</version>
</dependency>

Usages

a. Controller

Requires javax.persistence-api, spring-data-jpa, spring-web and spring-webmvc

@GetMapping(value = "/search")
public List<Entity> search(@EntityFilter Specification<Entity> spec, Pageable page) {
  return repo.findAll(spec, page);
}

The repository should implement JpaSpecificationExecutor in order to execute Spring's Specification, SimpleJpaRepository is a well known implementation. You can remove the Pageable argument if pagination is not needed.

b. Specification

Requires javax.persistence-api, spring-data-jpa, spring-web

Specification<Entity> spec = new FilterSpecification<Entity>(input);

c. Predicate

Requires javax.persistence-api, spring-data-jpa

Predicate predicate = FilterCompiler.parse(String input, Root<?> r, CriteriaQuery<?> q, CriteriaBuilder cb);

⚠️ If you need to search over relations, you also require hibernate-core

d. Builder

/* Using static methods */
import static com.turkraft.springfilter.FilterQueryBuilder.*;
Filter filter = filter(like("name", "%jose%"));
/* Using lombok builder */
Filter filter = Filter.builder()
    .body(ConditionInfix.builder()
        .left(Field.builder()
            .name("name")
            .build())
        .comparator(Comparator.LIKE)
        .right(Input.builder()
            .value(Text.builder()
                .value("%jose%")
                .build())
            .build())
        .build())
    .build();
String input = filter.generate(); // name ~ '%jose%'
Predicate predicate = filter.generate(Root<?> r, CriteriaQuery<?> cq, CriteriaBuilder cb);
Specification<Entity> spec = new FilterSpecification<Entity>(filter);

Syntax

Fields

Field names should be directly given without any extra literals. Dots indicate nested fields. For example: category.updatedAt

Inputs

Numbers should be directly given. Booleans should also directly be given, valid values are true and false (case insensitive). Others such as strings, enums, dates, should be quoted. For example: status : 'active'

Operators

Literal (case insensitive) Description Example
and and's two expressions status : 'active' and createdAt > '1-1-2000'
or or's two expressions value ~ 'hello' or name ~ 'world'
not not's an expression not (id > 100 or category.order is null)

You may prioritize operators using parentheses, for example: x and (y or z)

Comparators

Literal (case insensitive) Description Example
~ checks if the left (string) expression is similar to the right (string) expression catalog.name ~ 'electronic%'
: checks if the left expression is equal to the right expression id : 5
! checks if the left expression is not equal to the right expression username ! 'torshid'
> checks if the left expression is greater than the right expression distance > 100
>: checks if the left expression is greater or equal to the right expression distance >: 100
< checks if the left expression is smaller than the right expression distance < 100
<: checks if the left expression is smaller or equal to the right expression distance <: 100
is null checks if an expression is null status is null
is not null checks if an expression is not null status is not null
is empty checks if the (collection) expression is empty children is empty
is not empty checks if the (collection) expression is not empty children is not empty
in checks if an expression is present in the right expressions status in ('initialized', 'active')

Functions

A function is characterized by its name (case insensitive) followed by parentheses. For example: currentTime(). Some functions might also take arguments, arguments are seperated with commas. For example: min(ratings) > 3

Name Description Example
absolute returns the absolute absolute(x)
average returns the average average(ratings)
min returns the minimum min(ratings)
max returns the maximum max(ratings)
sum returns the sum sum(scores)
currentDate returns the current date currentDate()
currentTime returns the current time currentTime()
currentTimestamp returns the current time stamp currentTimestamp()
size returns the collection's size size(accidents)
length returns the string's length length(name)
trim returns the trimmed string trim(name)

Configuration

You may want to customize the behavior of the different processes taking place. For now, you can only change the date format but advanced customization will be soon available in order to let you completely personalize the tokenizer, the parser, the query builder, with the possibility of adding custom functions and much more.

Date format

You are able to change the date format by setting the static DATE_FORMATTER field of the FilterConfig class. You can also set it with the property turkraft.springfilter.dateformatter.pattern

Notes

When using @EntityFilter, sorting is automatically done. The logic behind that is to support sorting nested fields, and to avoid duplicated joins if sorting was to be done externally. If you still want to manually sort or disable sorting completely, you may do it with @EntityFilter(sortParameterName = "")

Contributing

Ideas and pull requests are always welcome.

License

Distributed under the MIT license.

Comments
  • JavaScript Query Builder

    JavaScript Query Builder

    Hi everyone 👋

    I am planning to create a JavaScript filter builder which I think will be helpful when calling APIs with frontend frameworks such as Vue or Angular. It should be similar to the FilterBuilder class.

    Example:

    // lastName : 'Doe' and birthDate > '1-01-2000'
    const filter =
        and(
            equal('lastName', 'Doe'),
            greaterThan('birthDate', '1-01-2000')
        ).generate();
    
    const req = await fetch('http://api/person?filter=' + filter);
    

    Let me know if you're interested, if you have suggestions or things you would like to see. :)

    Edit: we now have our builder https://github.com/sisimomo/Spring-Filter-Query-Builder!

    discussion 
    opened by torshid 10
  • filter By mongo string id like (~)

    filter By mongo string id like (~)

    Hi there,

    when i was testing you library, nice work btw, I was trying to filter entity ID by like '~' but wasn't working.

    /filter?filter=id : '612f8b56800fb96a21e7dc23' // this work (filtering with ':')
    /filter?filter=id ~ '612f8b56800fb96a21e7dc23' // this doesn't work (return empty list)
    /filter?filter=id ~ '612f8b' // this doesn't work (return empty list)
    

    logging the document value, this is how it's written (when using like '~' ):

    doc: Document{{id=BsonRegularExpression{pattern='612f8b56800fb96a21e7dc23', options=''}}}
    

    btw, here is my entity:

    @Document(collection = "person")
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder(toBuilder = true)
    public class Person{
    
        @Id
        private String id ;
        
        ........
    }
    

    I have made some search, and i find out that i can't search by id portion, since it's saved as ObjectId, and not as string. link: https://stackoverflow.com/a/32777342/4771750

    ... but do you know a way to do it?

    enhancement help wanted 
    opened by chlegou 9
  • Problems with operator ~

    Problems with operator ~

    Hi turkraft, I have problems with the ~ operator. In particular, in the README it is written that "the * character can also be used instead of % when using the ~ comparator" but it functions only with *. Thank you.

    help wanted 
    opened by glodepa 7
  • Sharing instance of NumberFormat can cause diffrent results

    Sharing instance of NumberFormat can cause diffrent results

    When parallel requests are sent via filter, the sharing NumberFormat instance parse randomly different numbers. Sometimes it fails , sometime its correct and sometimes it parses a double out.

    The issue is caused by your StringConverter.class

    An simple example that causes the issue:

    public class Scratch extends Thread {
    
        public static final NumberFormat NUMBER_FORMAT ;
    
        public static void main(String args[]) {
            for (int i = 0; i < 3; i++) {
                Scratch thread = new Scratch();
                thread.start();
            }
        }
    
        public void run() {
            ParsePosition position = new ParsePosition(0);
            Number number = NUMBER_FORMAT.parse("1011", position);
            System.out.println(number);
        }
    
        static {
            NUMBER_FORMAT = NumberFormat.getInstance(Locale.US);
            NUMBER_FORMAT.setGroupingUsed(false);
        }
    }
    

    The issue disapers, if we use a new instance of Numberformat in every Thread:

    public class Scratch extends Thread {
    
    
        public static void main(String args[]) {
            for (int i = 0; i < 5; i++) {
                Scratch thread = new Scratch();
                thread.start();
            }
        }
    
        public void run() {
            ParsePosition position = new ParsePosition(0);
            NumberFormat format = NumberFormat.getInstance(Locale.US);
            format.setGroupingUsed(false);
            Number number = format.parse("1011", position);
            System.out.println(number);
        }
      
    }
    
    bug 
    opened by capussopy 6
  • Support filter nested collection

    Support filter nested collection

    It would be a nice feature or I doest find it yet to filter nested collection.

    Like in the Live Example to filter Company with

    (id < 10 and employees.maritalStatus: "unknown") curl -X 'GET'
    'https://spring-filter.herokuapp.com/company?filter=id%20%3C%2010%20and%20employees.maritalStatus%3A%22unknown%22'
    -H 'accept: /'

    Expected Output

    [
      {
        "id": 4,
        "name": "Huel Inc",
        "industry": {
          "id": 3,
          "name": "Capital Markets"
        },
        "employees": [
          {
            "id": 11,
            "firstName": "Johana",
            "lastName": "Crona",
            "birthDate": "13-09-1980",
            "maritalStatus": "unknown",
            "salary": 2301
          },
          {
            "id": 16,
            "firstName": "Cora",
            "lastName": "Lebsack",
            "birthDate": "18-10-1961",
            "maritalStatus": "unknown",
            "salary": 5783
          }
        ]
      }
    ]
    

    In my own example with one Entity and 3 Elements in nested collection i got 3 times the same response

    enhancement invalid 
    opened by MichaelKoch11 6
  • Global filters of all/selected fields

    Global filters of all/selected fields

    If I have two or more fields, be able to search in all of them at the same time (or in the selected fields).

    My problem is the next one: You have a table with Names and Surnames in two Columns (or paramters in the returned object):

    NAME SURNAME

    JOHN DOE JOHN SMITH PAMELA DOE PAMELA SMITH

    Now if I search "Smith", with AND/OR operators, the result will be "John Smith, Pamela Smith", but if I want to be more specific and I search "John%Smith", (name~'John%Smith' AND surname~'John%Smith') the result will be all of them, so the results are worst as more parameters I search, because more words can appear on those fields.

    In my proposition, I think something about: "globalFilter:name,surname~'John%Smith'" only the "John Smith will be returned, as it is the only one which contains the search term in the parameters selected.

    I don't know if I explained myself enough, english is not my native language.

    Your project has made me want to build APIs again with Spring, It's wonderful and this is the only think that I really missed, I hope it's possible to code... Thank you!

    help wanted 
    opened by albertodiazsaez 6
  • UUID and OffsetDateTime support

    UUID and OffsetDateTime support

    Hi, I'm trying to integrate your library into one of my projects. Since my base JPA entity has a PK UUID, and @UpdateTimestamp @CreationTimestamp declared as OffsetDateTime I could find a way to search for them. Could you please give me some hints. Best Regards.

    enhancement 
    opened by petka5 6
  • Spring data-jpa/mongo dependencies

    Spring data-jpa/mongo dependencies

    @Configuration
    public class FilterWebConfig implements WebMvcConfigurer {
    
      @Override
      public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        argumentResolvers.add(new SpecificationFilterArgumentResolver());
        argumentResolvers.add(new DocumentFilterArgumentResolver());
      }
    
    }
    

    While I was integrating the library in a mongo only project, i noticed that at startup both resolvers are automatically added to the runtime environment, causing a ClassNotFoundException, if either JPA or Mongo dependency is not in the classpath. The pom.xml states those dependecy with <optional>true</optional> so i guess these resolvers must be registered dinamically according to this. This is not a bug...it's a feature👯‍♂️ , since now the library both supports spring-data-mongodb and spring-data-jpa.

    bug 
    opened by marcopag90 6
  • Date pattern improvment

    Date pattern improvment

    Hey!

    Entity class can map Db field of timestamp format to Date field. It would be great to have the possibility to filter by that kind of field not only by date but by date and time both. So for such cases, it would be needed to set the Date pattern as dd-MM-yyyy'T'HH:mm:ss.

    Could you improve this? Thanks.

    help wanted 
    opened by Jeffster2021 5
  • MongoDB date fields support

    MongoDB date fields support

    Ok so, I'm opening this issue for further investigations over the ability to query a date field via MongoRepository.

    I've found this project to start from: https://github.com/RutledgePaulV/rsql-mongodb

    This is using the Visitor pattern. A bit different, but same result. Maybe it could be inspiring.

    enhancement 
    opened by marcopag90 5
  • Support for Security Expression

    Support for Security Expression

    Thanks for this good library! It would be great to have support for security expressions similarly to Spring in @Query (https://docs.spring.io/spring-security/site/docs/4.0.1.RELEASE/reference/htmlsingle/#data).

    help wanted 
    opened by vittoN 4
  • exclude the filters on unavailable fields (like the fields with @Transient)

    exclude the filters on unavailable fields (like the fields with @Transient)

    hello

    In the first thanks a lot for your amazing library 😄

    My issue is about filtering transient fields and obviously these fields are not present in my table so the jpa repository throw exception when I send specification in findAll method

    opened by 8fatemeT8 0
  • ZonedDateTime support

    ZonedDateTime support

    Please would it be possible to add support for filtering fields with ZonedDateTime? Or Is there some bean that can be exposed so that we can implement our own type conversions?

    opened by Fejiro-A 0
  • Support for Spring Boot 3.0

    Support for Spring Boot 3.0

    When I try use the library in Spring Boot 3.0, I get error from jakarta.

    java.lang.AbstractMethodError: Receiver class com.turkraft.springfilter.boot.FilterSpecification does not define or inherit an implementation of the resolved method 'abstract jakarta.persistence.criteria.Predicate toPredicate(jakarta.persistence.criteria.Root, jakarta.persistence.criteria.CriteriaQuery, jakarta.persistence.criteria.CriteriaBuilder)' of interface org.springframework.data.jpa.domain.Specification.
    
    

    The actual version implement javax.persistance instead of jakarta.persistance

    opened by MiguelAngelLV 4
  • Bump springframework-boot.version from 2.6.3 to 3.0.0

    Bump springframework-boot.version from 2.6.3 to 3.0.0

    Bumps springframework-boot.version from 2.6.3 to 3.0.0. Updates spring-boot-starter-test from 2.6.3 to 3.0.0

    Release notes

    Sourced from spring-boot-starter-test's releases.

    v3.0.0

    :star: New Features

    • Provide a configuration property for the observation patterns of Spring Integration components #33099

    :lady_beetle: Bug Fixes

    • io.micrometer.tracing.Tracer on the classpath breaks AOT processing for tests #33298
    • Tracer library HTTP instrumentation is auto-configured unnecessarily #33287
    • Auto-configuration ignores user-provided ObservationConventions #33285
    • ScheduledBeanLazyInitializationExcludeFilter is auto-configured even when annotation-based scheduled has not been enabled #33284
    • SpringBootContextLoader prints banner twice when using a @ContextHierarchy #33263
    • Properties migrator causes an application to fail to start if it tries to map a property whose metadata data entry contains an invalid configuration property name #33250
    • Wavefront MeterRegistryCustomizer is not applying application tags from application.properties #33244
    • Actuator responses no longer format timestamps as ISO-8601 #33236
    • Configuration property is not bound in a native image when property has get, set, and is methods #33232
    • Configuration property binding does not deal with bridge methods #33212
    • Contribute missing resource hints for GraphQL schema files and GraphiQL HTML page #33208
    • Hints for ClientHttpRequestFactory should only be generated for matching methods #33203
    • Native profile should configure execution in pluginManagement #33184
    • Configuring management.server.port via a config tree results in a ConverterNotFoundException when the management context is refreshed #33169
    • JBoss logging does not route directly to SLF4J when using Logback #33155
    • Test with UseMainMethod.Always do not work with Kotlin main functions #33114
    • Maven process-aot does not specify source and target release when compiling generated sources #33112
    • Some Actuator beans are ineligible for post-processing #33110
    • AOT-generated source fails to compile when Actuator is enabled on a WebFlux project #33106
    • @ContextHierarchy should never be used with main method #33078
    • Maven process-aot fails when compiler plugin has been configured with --enable-preview #33012
    • Wavefront application tags differ from those used in a Spring Boot 2.x application #32844
    • Maven goal spring-boot:build-image runs package phase twice #26455

    :notebook_with_decorative_cover: Documentation

    • Document observation for R2DBC #33335
    • Align Tomcat multiple connectors example with recommendation to configure SSL declaratively #33333
    • Actuator document is misleading about k8s startup probe #33327
    • Update documented for @Timed to reflect narrower support #33282
    • Update reference documentation to replace mentions of tags providers and contributors with their Observation-based equivalents #33281
    • Link to Micrometer's @Timed documentation #33266
    • Clarify use of the spring.cache.type property with Hazelcast #33258
    • Example git.commit.time in the Actuator API documentation is thousands of years in the future #33256
    • Update Spring Security filter dispatcher types docs to reflect change in default value #33252
    • Documentation for nested configuration properties in a native image uses @NestedConfigurationProperty too widely #33239
    • Document that the jar task should not be disabled when building a native image #33238
    • Document nesting configuration properties using records or Kotlin data classes and how and when to use @NestedConfigurationProperty #33235
    • Links to Features describes sections that have moved elsewhere #33214
    • Fix broken links in docs #33209
    • Document the need for compilation with -parameters when targeting a native image #33182
    • Remove outdated native image documentation #33109
    • Mention @RegisterReflectionForBinding in the docs #32903

    ... (truncated)

    Commits
    • c9c359f Release v3.0.0
    • fb2cc73 Work around Thymeleaf's dependency on spring-security-bom:6.0.0-RC2
    • 355b428 Merge branch '2.7.x'
    • 7ea5881 Update LATEST_GA to false to prepare for 3.0.0's release
    • 1de09f4 Merge branch '2.6.x' into 2.7.x
    • e922650 Upgrade to Spring Framework 6.0.2
    • 4b8a28a Next development version (v2.7.7-SNAPSHOT)
    • 14ba9b1 Start building against Spring Framework 6.0.2 snapshots
    • d4a9100 Next development version (v2.6.15-SNAPSHOT)
    • 28cb225 Merge branch '2.7.x'
    • Additional commits viewable in compare view

    Updates spring-boot-starter-web from 2.6.3 to 3.0.0

    Release notes

    Sourced from spring-boot-starter-web's releases.

    v3.0.0

    :star: New Features

    • Provide a configuration property for the observation patterns of Spring Integration components #33099

    :lady_beetle: Bug Fixes

    • io.micrometer.tracing.Tracer on the classpath breaks AOT processing for tests #33298
    • Tracer library HTTP instrumentation is auto-configured unnecessarily #33287
    • Auto-configuration ignores user-provided ObservationConventions #33285
    • ScheduledBeanLazyInitializationExcludeFilter is auto-configured even when annotation-based scheduled has not been enabled #33284
    • SpringBootContextLoader prints banner twice when using a @ContextHierarchy #33263
    • Properties migrator causes an application to fail to start if it tries to map a property whose metadata data entry contains an invalid configuration property name #33250
    • Wavefront MeterRegistryCustomizer is not applying application tags from application.properties #33244
    • Actuator responses no longer format timestamps as ISO-8601 #33236
    • Configuration property is not bound in a native image when property has get, set, and is methods #33232
    • Configuration property binding does not deal with bridge methods #33212
    • Contribute missing resource hints for GraphQL schema files and GraphiQL HTML page #33208
    • Hints for ClientHttpRequestFactory should only be generated for matching methods #33203
    • Native profile should configure execution in pluginManagement #33184
    • Configuring management.server.port via a config tree results in a ConverterNotFoundException when the management context is refreshed #33169
    • JBoss logging does not route directly to SLF4J when using Logback #33155
    • Test with UseMainMethod.Always do not work with Kotlin main functions #33114
    • Maven process-aot does not specify source and target release when compiling generated sources #33112
    • Some Actuator beans are ineligible for post-processing #33110
    • AOT-generated source fails to compile when Actuator is enabled on a WebFlux project #33106
    • @ContextHierarchy should never be used with main method #33078
    • Maven process-aot fails when compiler plugin has been configured with --enable-preview #33012
    • Wavefront application tags differ from those used in a Spring Boot 2.x application #32844
    • Maven goal spring-boot:build-image runs package phase twice #26455

    :notebook_with_decorative_cover: Documentation

    • Document observation for R2DBC #33335
    • Align Tomcat multiple connectors example with recommendation to configure SSL declaratively #33333
    • Actuator document is misleading about k8s startup probe #33327
    • Update documented for @Timed to reflect narrower support #33282
    • Update reference documentation to replace mentions of tags providers and contributors with their Observation-based equivalents #33281
    • Link to Micrometer's @Timed documentation #33266
    • Clarify use of the spring.cache.type property with Hazelcast #33258
    • Example git.commit.time in the Actuator API documentation is thousands of years in the future #33256
    • Update Spring Security filter dispatcher types docs to reflect change in default value #33252
    • Documentation for nested configuration properties in a native image uses @NestedConfigurationProperty too widely #33239
    • Document that the jar task should not be disabled when building a native image #33238
    • Document nesting configuration properties using records or Kotlin data classes and how and when to use @NestedConfigurationProperty #33235
    • Links to Features describes sections that have moved elsewhere #33214
    • Fix broken links in docs #33209
    • Document the need for compilation with -parameters when targeting a native image #33182
    • Remove outdated native image documentation #33109
    • Mention @RegisterReflectionForBinding in the docs #32903

    ... (truncated)

    Commits
    • c9c359f Release v3.0.0
    • fb2cc73 Work around Thymeleaf's dependency on spring-security-bom:6.0.0-RC2
    • 355b428 Merge branch '2.7.x'
    • 7ea5881 Update LATEST_GA to false to prepare for 3.0.0's release
    • 1de09f4 Merge branch '2.6.x' into 2.7.x
    • e922650 Upgrade to Spring Framework 6.0.2
    • 4b8a28a Next development version (v2.7.7-SNAPSHOT)
    • 14ba9b1 Start building against Spring Framework 6.0.2 snapshots
    • d4a9100 Next development version (v2.6.15-SNAPSHOT)
    • 28cb225 Merge branch '2.7.x'
    • Additional commits viewable in compare view

    Updates spring-boot-starter-data-mongodb from 2.6.3 to 3.0.0

    Release notes

    Sourced from spring-boot-starter-data-mongodb's releases.

    v3.0.0

    :star: New Features

    • Provide a configuration property for the observation patterns of Spring Integration components #33099

    :lady_beetle: Bug Fixes

    • io.micrometer.tracing.Tracer on the classpath breaks AOT processing for tests #33298
    • Tracer library HTTP instrumentation is auto-configured unnecessarily #33287
    • Auto-configuration ignores user-provided ObservationConventions #33285
    • ScheduledBeanLazyInitializationExcludeFilter is auto-configured even when annotation-based scheduled has not been enabled #33284
    • SpringBootContextLoader prints banner twice when using a @ContextHierarchy #33263
    • Properties migrator causes an application to fail to start if it tries to map a property whose metadata data entry contains an invalid configuration property name #33250
    • Wavefront MeterRegistryCustomizer is not applying application tags from application.properties #33244
    • Actuator responses no longer format timestamps as ISO-8601 #33236
    • Configuration property is not bound in a native image when property has get, set, and is methods #33232
    • Configuration property binding does not deal with bridge methods #33212
    • Contribute missing resource hints for GraphQL schema files and GraphiQL HTML page #33208
    • Hints for ClientHttpRequestFactory should only be generated for matching methods #33203
    • Native profile should configure execution in pluginManagement #33184
    • Configuring management.server.port via a config tree results in a ConverterNotFoundException when the management context is refreshed #33169
    • JBoss logging does not route directly to SLF4J when using Logback #33155
    • Test with UseMainMethod.Always do not work with Kotlin main functions #33114
    • Maven process-aot does not specify source and target release when compiling generated sources #33112
    • Some Actuator beans are ineligible for post-processing #33110
    • AOT-generated source fails to compile when Actuator is enabled on a WebFlux project #33106
    • @ContextHierarchy should never be used with main method #33078
    • Maven process-aot fails when compiler plugin has been configured with --enable-preview #33012
    • Wavefront application tags differ from those used in a Spring Boot 2.x application #32844
    • Maven goal spring-boot:build-image runs package phase twice #26455

    :notebook_with_decorative_cover: Documentation

    • Document observation for R2DBC #33335
    • Align Tomcat multiple connectors example with recommendation to configure SSL declaratively #33333
    • Actuator document is misleading about k8s startup probe #33327
    • Update documented for @Timed to reflect narrower support #33282
    • Update reference documentation to replace mentions of tags providers and contributors with their Observation-based equivalents #33281
    • Link to Micrometer's @Timed documentation #33266
    • Clarify use of the spring.cache.type property with Hazelcast #33258
    • Example git.commit.time in the Actuator API documentation is thousands of years in the future #33256
    • Update Spring Security filter dispatcher types docs to reflect change in default value #33252
    • Documentation for nested configuration properties in a native image uses @NestedConfigurationProperty too widely #33239
    • Document that the jar task should not be disabled when building a native image #33238
    • Document nesting configuration properties using records or Kotlin data classes and how and when to use @NestedConfigurationProperty #33235
    • Links to Features describes sections that have moved elsewhere #33214
    • Fix broken links in docs #33209
    • Document the need for compilation with -parameters when targeting a native image #33182
    • Remove outdated native image documentation #33109
    • Mention @RegisterReflectionForBinding in the docs #32903

    ... (truncated)

    Commits
    • c9c359f Release v3.0.0
    • fb2cc73 Work around Thymeleaf's dependency on spring-security-bom:6.0.0-RC2
    • 355b428 Merge branch '2.7.x'
    • 7ea5881 Update LATEST_GA to false to prepare for 3.0.0's release
    • 1de09f4 Merge branch '2.6.x' into 2.7.x
    • e922650 Upgrade to Spring Framework 6.0.2
    • 4b8a28a Next development version (v2.7.7-SNAPSHOT)
    • 14ba9b1 Start building against Spring Framework 6.0.2 snapshots
    • d4a9100 Next development version (v2.6.15-SNAPSHOT)
    • 28cb225 Merge branch '2.7.x'
    • Additional commits viewable in compare view

    Updates spring-boot-maven-plugin from 2.6.3 to 3.0.0

    Release notes

    Sourced from spring-boot-maven-plugin's releases.

    v3.0.0

    :star: New Features

    • Provide a configuration property for the observation patterns of Spring Integration components #33099

    :lady_beetle: Bug Fixes

    • io.micrometer.tracing.Tracer on the classpath breaks AOT processing for tests #33298
    • Tracer library HTTP instrumentation is auto-configured unnecessarily #33287
    • Auto-configuration ignores user-provided ObservationConventions #33285
    • ScheduledBeanLazyInitializationExcludeFilter is auto-configured even when annotation-based scheduled has not been enabled #33284
    • SpringBootContextLoader prints banner twice when using a @ContextHierarchy #33263
    • Properties migrator causes an application to fail to start if it tries to map a property whose metadata data entry contains an invalid configuration property name #33250
    • Wavefront MeterRegistryCustomizer is not applying application tags from application.properties #33244
    • Actuator responses no longer format timestamps as ISO-8601 #33236
    • Configuration property is not bound in a native image when property has get, set, and is methods #33232
    • Configuration property binding does not deal with bridge methods #33212
    • Contribute missing resource hints for GraphQL schema files and GraphiQL HTML page #33208
    • Hints for ClientHttpRequestFactory should only be generated for matching methods #33203
    • Native profile should configure execution in pluginManagement #33184
    • Configuring management.server.port via a config tree results in a ConverterNotFoundException when the management context is refreshed #33169
    • JBoss logging does not route directly to SLF4J when using Logback #33155
    • Test with UseMainMethod.Always do not work with Kotlin main functions #33114
    • Maven process-aot does not specify source and target release when compiling generated sources #33112
    • Some Actuator beans are ineligible for post-processing #33110
    • AOT-generated source fails to compile when Actuator is enabled on a WebFlux project #33106
    • @ContextHierarchy should never be used with main method #33078
    • Maven process-aot fails when compiler plugin has been configured with --enable-preview #33012
    • Wavefront application tags differ from those used in a Spring Boot 2.x application #32844
    • Maven goal spring-boot:build-image runs package phase twice #26455

    :notebook_with_decorative_cover: Documentation

    • Document observation for R2DBC #33335
    • Align Tomcat multiple connectors example with recommendation to configure SSL declaratively #33333
    • Actuator document is misleading about k8s startup probe #33327
    • Update documented for @Timed to reflect narrower support #33282
    • Update reference documentation to replace mentions of tags providers and contributors with their Observation-based equivalents #33281
    • Link to Micrometer's @Timed documentation #33266
    • Clarify use of the spring.cache.type property with Hazelcast #33258
    • Example git.commit.time in the Actuator API documentation is thousands of years in the future #33256
    • Update Spring Security filter dispatcher types docs to reflect change in default value #33252
    • Documentation for nested configuration properties in a native image uses @NestedConfigurationProperty too widely #33239
    • Document that the jar task should not be disabled when building a native image #33238
    • Document nesting configuration properties using records or Kotlin data classes and how and when to use @NestedConfigurationProperty #33235
    • Links to Features describes sections that have moved elsewhere #33214
    • Fix broken links in docs #33209
    • Document the need for compilation with -parameters when targeting a native image #33182
    • Remove outdated native image documentation #33109
    • Mention @RegisterReflectionForBinding in the docs #32903

    ... (truncated)

    Commits
    • c9c359f Release v3.0.0
    • fb2cc73 Work around Thymeleaf's dependency on spring-security-bom:6.0.0-RC2
    • 355b428 Merge branch '2.7.x'
    • 7ea5881 Update LATEST_GA to false to prepare for 3.0.0's release
    • 1de09f4 Merge branch '2.6.x' into 2.7.x
    • e922650 Upgrade to Spring Framework 6.0.2
    • 4b8a28a Next development version (v2.7.7-SNAPSHOT)
    • 14ba9b1 Start building against Spring Framework 6.0.2 snapshots
    • d4a9100 Next development version (v2.6.15-SNAPSHOT)
    • 28cb225 Merge branch '2.7.x'
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump spring-data-mongodb from 3.3.1 to 4.0.0

    Bump spring-data-mongodb from 3.3.1 to 4.0.0

    Bumps spring-data-mongodb from 3.3.1 to 4.0.0.

    Release notes

    Sourced from spring-data-mongodb's releases.

    4.0.0

    :green_book: Links

    :star: New Features

    • Equals, hashcode and toString methods for CollectionOptions #4210

    :notebook_with_decorative_cover: Documentation

    • Replace news and noteworthy with links to the release notes. #4228

    4.0.0-RC2

    :green_book: Links

    :star: New Features

    • Improve configuration support for Observability integration #4216

    :lady_beetle: Bug Fixes

    • Use correct boolean type for JSON Schema creation #4220
    • Add missing reflection hint for QuerydslMongoPredicateExecutor #4211

    :heart: Contributors

    We'd like to thank all the contributors who worked on this release!

    4.0.0-RC1

    :green_book: Links

    :star: New Features

    • Remove references to ClassTypeInformation from TypeInformation #4195
    • Change Streams fullDocumentBeforeChange support #4187
    • Add new aggregation variables to SystemVariable #4145
    • Add support for MongoDB 6.0 Aggregation changes #4139

    :lady_beetle: Bug Fixes

    • Failed usage of provided ID value on document insert #4184
    • Point must only contain numeric elements when using near count query with GeoJson points #4004

    :notebook_with_decorative_cover: Documentation

    • Update documentation example to configure Reactive Transactional Support #4190
    • Prefer Java configuration over XML #4186

    ... (truncated)

    Commits
    • 548cbd8 Release version 4.0 GA (2022.0.0).
    • 02647ad Prepare 4.0 GA (2022.0.0).
    • fe549f7 Add Nullable annotation to parameter of overridden equals method.
    • c069e09 Implement equals, hashCode and toString for CollectionOptions.
    • 62f3656 Replace upgrading section in documentation with links to the release notes.
    • cbc718e Upgrade to MongoDB driver 4.8.0
    • 23be69b Upgrade to MongoDB driver 4.8.0-rc0
    • b7b5b08 Remove micrometer docs plugin.
    • 2d292c5 After release cleanups.
    • f959a77 Prepare next development iteration.
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
Releases(2.1.3)
  • 2.1.3(Dec 9, 2022)

  • 2.1.2(Nov 30, 2022)

  • 2.1.1(Jun 24, 2022)

    • Mongo count fix https://github.com/turkraft/spring-filter/pull/22
    • Fixed setting custom codec regression https://github.com/turkraft/spring-filter/pull/223
    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Jun 15, 2022)

    Do not use this release as it may cause crashes due to a regression, see #220.

    ~~Support for Mongo custom codec https://github.com/turkraft/spring-filter/pull/215~~

    Source code(tar.gz)
    Source code(zip)
  • 2.0.9(Apr 27, 2022)

  • 2.0.8(Mar 9, 2022)

  • 2.0.7(Feb 24, 2022)

    Added JAVA_TYPE_MODIFIER parameter to ExpressionGeneratorParameters, in order to change the real type of an expression. For example, if we have an entity attribute which is of type Object but we want Spring Filter to interpret it as a String, we can do the following configuration:

    ExpressionGeneratorParameters.JAVA_TYPE_MODIFIER = expression -> {
      if (expression instanceof SingularAttributePath) {
        SingularAttributePath<?> path = (SingularAttributePath<?>) expression;
        if (path.getJavaType().equals(Object.class)) {
          return String.class;
        }
      }
      return null; // do not change default behavior
    };
    
    Source code(tar.gz)
    Source code(zip)
  • 2.0.6(Jan 6, 2022)

  • 2.0.5(Dec 20, 2021)

  • 2.0.4(Nov 26, 2021)

  • 2.0.3(Nov 4, 2021)

  • 2.0.2(Oct 15, 2021)

  • 2.0.1(Oct 11, 2021)

  • 2.0.0(Oct 8, 2021)

    The homemade parser has been replaced by ANTLR, but no changes to the query syntax.

    Breaking changes:

    • IExpression is now Filter
    • SpringFilterUtils is now FilterUtils
    • SpringFilterParameters is now FilterParameters
    • The CASE_SENSITIVE_LIKE_OPERATOR property is now inside FilterParameters

    Parsing a query input to a Filter should now be done with Filter.from(query).

    Source code(tar.gz)
    Source code(zip)
  • 1.1.0(Sep 27, 2021)

  • 1.0.9(Sep 26, 2021)

  • 1.0.8(Sep 24, 2021)

  • 1.0.7(Sep 21, 2021)

  • 1.0.6(Sep 17, 2021)

  • 1.0.5(Aug 11, 2021)

  • 1.0.4(Jun 10, 2021)

    Support for dates and other field types with MongoDB.

    Breaking change: when using MongoDB, the entity class on which filtering is applied should be provided to the @Filter annotation:

    @GetMapping(value = "car")
    public List<Car> getCars(@Filter(entityClass = Car.class) Document filter) {
      return carRepository.findAll(filter);
    }
    
    Source code(tar.gz)
    Source code(zip)
  • 1.0.3(May 25, 2021)

  • 1.0.2(May 4, 2021)

    Added upper, lower, and concat functions. Also added the CASE_SENSITIVE_LIKE_OPERATOR in ExpressionGeneratorParameters in order to manually handle the ~ operator.

    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(May 3, 2021)

  • 1.0.0(Apr 28, 2021)

    Contains breaking changes in the code, but no changes in the query syntax. The library no longer targets JPA, but it now also supports MongoDB, and can easily provide filtering for any other technology.

    • @EntityFilter -> @Filter
    • FilterQueryBuilder -> FilterBuilder
    Source code(tar.gz)
    Source code(zip)
  • 0.9.9(Apr 28, 2021)

  • 0.9.8(Apr 26, 2021)

  • 0.9.7(Apr 25, 2021)

  • 0.9.6(Apr 25, 2021)

    Added support for MongoDB.

    Supported operations are:

    • and, or, not
    • equal, not equal
    • greater than, greater than or equal
    • less than, less than or equal
    • like (regex)
    • in

    Supported field types are:

    • numbers
    • booleans
    • strings
    Source code(tar.gz)
    Source code(zip)
  • 0.9.5(Apr 11, 2021)

Spring JPA @Query for custom query in Spring Boot example

Spring JPA @Query example (Custom query) in Spring Boot Use Spring JPA @Query for custom query in Spring Boot example: Way to use JPQL (Java Persisten

null 17 Dec 3, 2022
This repository contains source code examples to support my course Spring Data JPA and Hibernate Beginner to Guru

Spring Data JPA - Spring Data JPA This repository contains source code examples to support my course Spring Data JPA and Hibernate Beginner to Guru Co

John Thompson 8 Aug 24, 2022
Applied Spring Data JPA technologies including mapping, connecting real DB, Hibernate, Queries, Paging & Sorting, various Relationships, Transactions

University Management In this project, I practiced & applied Spring Data JPA technologies including mapping, connecting real DB, Hibernate, Queries, P

SarvarKhalimov 2 Sep 5, 2022
Spring JPA Many To Many example with Hibernate and Spring Boot CRUD Rest API - ManyToMany annotation

Spring JPA Many To Many example with Hibernate and Spring Boot CRUD Rest API - ManyToMany annotation

null 17 Dec 28, 2022
A simple quarkus app with hibernate as ORM, used to show the features of Hibernate Search

beer-manager-hibernate-search Project This project uses Quarkus, the Supersonic Subatomic Java Framework. If you want to learn more about Quarkus, ple

Sedona Solutions 3 Jan 6, 2022
Spring JPA Native Query example in Spring Boot

Spring JPA Native Query example in Spring Boot

null 12 Nov 30, 2022
A code sharing platform built using spring boot, hibernate and JPA as ORM with PostgreSQL which also follows a RESTful architecture.

Snap-Snippet A code sharing platform built using spring boot, hibernate and JPA as ORM with PostgreSQL which also follows a RESTful architecture. Tech

Adnan Hossain 7 Nov 29, 2022
Spring Boot JWT Authentication example with Spring Security & Spring Data JPA

Spring Boot JWT Authentication example with Spring Security & Spring Data JPA

null 1 Jan 26, 2022
Spring Kurulumundan Başlayarak, Spring IOC ve Dependency Injection, Hibernate, Maven ve Spring Boot Konularına Giriş Yapıyoruz.

Spring Tutorial for Beginners File Directory Apache Tomcat Apache Tomcat - Eclipse Bağlantısı Spring Paketlerinin İndirilmesi ve Projeye Entegrasyonu

İbrahim Can Erdoğan 11 Apr 11, 2022
In this project, we will implement two Spring Boot Java Web application called, streamer-data-jpa and streamer-data-r2dbc.

In this project, we will implement two Spring Boot Java Web application called, streamer-data-jpa and streamer-data-r2dbc. They both will fetch 1 million of customer's data from MySQL and stream them to Kafka. The main goal is to compare the application's performance and resource utilization.

Ivan Franchin 6 Nov 2, 2022
JHook - A tool that can dynamically modify Java classes at runtime.

JHook A tool that can dynamically modify Java classes at runtime. Demo Tested on Java 1.8 - Java 17, just support JDK package com.binklac.jhook.test;

VeroFess 11 Dec 23, 2022
An experimental mod that converts some block entities to blockstates. This is done for performance & functionality reasons.

BetterBlockStates An experimental mod that converts some block entities to blockstates. This is done for performance & functionality reasons. Current

Fx Morin 10 Sep 17, 2022
An examples of creating test records in the database with Spring Boot + Spring Data + JPA usage.

Spring Boot + JPA — Clear Tests An examples of creating test records in the database with Spring Boot + Spring Data + JPA usage. Check out the article

Semyon Kirekov 8 Nov 24, 2022
An example of how to working with paging in Spring for GraphQL / Spring Data JPA

Spring for GraphQL Paging This repo contains the code for a live coding session I did on: Spring Data JPA GraphQL Paging & Sorting The reason I put th

Dan Vega 10 Nov 28, 2022
循序渐进,学习Spring Boot、Spring Boot & Shiro、Spring Batch、Spring Cloud、Spring Cloud Alibaba、Spring Security & Spring Security OAuth2,博客Spring系列源码:https://mrbird.cc

Spring 系列教程 该仓库为个人博客https://mrbird.cc中Spring系列源码,包含Spring Boot、Spring Boot & Shiro、Spring Cloud,Spring Boot & Spring Security & Spring Security OAuth2

mrbird 24.8k Jan 6, 2023
A simple Project based on Jsp and Servlets and Hibernate.

Learning Management System in Java In this project, I have created a Simple Learning Management System which is based on Java server pages, Servlet &

Indranil Roy 1 Feb 2, 2022
The goal of the project is to create a web application using Java EE and database (PostgreSQL) without connecting a modern technology stack like spring boot and hibernate

About The Project SignIn page SignUp page Profile page The goal of the project is to create a web application using Java EE and database (PostgreSQL)

Islam Khabibullin 2 Mar 23, 2022
Automatic creation of simple CRUD API of Spring boot and JPA project.

fast-crud Automatic creation of simple CRUD API of Spring boot and JPA project.

JinHwanKim 18 Oct 23, 2022
Projeto de LAB: Conhendo o projeto Spring data JPA com Java na prática

Conhecendo o Projeto Spring Data JPA na Prática Sejam bem-vindos ao projeto de LAB Conhecendo o Projeto Spring Data JPA na Prática oferecido gratuitam

Camila Cavalcante 130 Dec 31, 2022