Nooul / spring-boot-rest-api-helpers

Java Spring REST API helpers for quick query building through JSON inspired by react-admin and offering an alternative to RSQL / FIQL
MIT License
36 stars 21 forks source link

Java 11 dependency error on 1.8 projects #18

Closed sb-davidegironi closed 3 years ago

sb-davidegironi commented 3 years ago

First of all I want to thank you for this library.

We are currently using NodeJS with https://github.com/lalalilo/express-sequelize-crud to make the MySQL db talk with the RA interface . I'm experimenting with your library to make all consistent with the Java technology I'm using for the main API backend developed for a small app, which is Spring Boot of course.

Our Spring Boot is compiled with Java 1.8 (1.8</java.version>), but you use 11. So we end up with an error that looks like this:

Application run failed
java.lang.UnsupportedClassVersionError: com/nooul/apihelpers/springbootrest/repositories/BaseRepository has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I'm recompiling your code with "1.8</java.version>" and all seems to work. Is there a reason why you set it to 11? Do you know how to make it compliant with 8? Also I've to delete the application-test.properties and the related dipendencies cause it makes any @SpringBootTest fails due to circular dependencies error on DataSourceInitializer.

Anyway I've forked your project and now it's working.

I'm building a Generic Controller and a DataProvider for RA which works with custom table Ids (like "users_id" instead of id), and Joins directly on entity. If anyone is interested i can share those two files.

This is my fork: https://github.com/telemedicacloud/spring-boot-rest-api-helpers

zifnab87 commented 3 years ago

thank you for the suggestion - the project is definitely not ready to be a mvn repo and it has probably more dependencies and constraints than needed. One of them might be that it could support java 8

On Wed, Mar 17, 2021, 18:38 sb-davidegironi @.***> wrote:

First of all I want to thank you for this library.

We are currently using NodeJS with https://github.com/lalalilo/express-sequelize-crud to make the MySQL db talk with the RA interface . I'm experimenting with your library to make all consistent with the Java technology I'm using for the main API backend developed for a small app, which is Spring Boot of course.

Our Spring Boot is compiled with Java 1.8 (1.8</java.version>), but you use 11. So we end up with an error that looks like this:

Application run failed java.lang.UnsupportedClassVersionError: com/nooul/apihelpers/springbootrest/repositories/BaseRepository has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I'm recompiling your code with "1.8</java.version>" and all seems to work. Is there a reason why you set it to 11? Do you know how to make it compliant with 8? Also I've to delete the application-test.properties and the related dipendencies cause it makes any @SpringBootTest https://github.com/SpringBootTest fails due to circular dependencies error on DataSourceInitializer.

Anyway I've forked your project and now it's working.

I'm building a Generic Controller and a DataProvider for RA which works with custom table Ids (like "users_id" instead of id), and Joins directly on entity. If anyone is interested i can share those two files.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Nooul/spring-boot-rest-api-helpers/issues/18, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEAN3UA3Z2MVFEWSDXRG3TTEDLJHANCNFSM4ZK57DOA .

sb-davidegironi commented 3 years ago

Here (master branch) you can find the refactored project, based on the your master branch: https://github.com/telemedicacloud/spring-boot-rest-api-helpers

The only test that is not working (even in your master branch is not working is reference_test_conjunctive_equality_in_list__fetch_actors_that_have_played_in_all_movies_of_query) Speaking about tests, JSON has to be changed cause values in query need to be comma delimited.

This makes easier the integration with other webservices.

In samplecode folder you can find the Generic Controller for Spring Boot and dataprovider for RA, with the full CRUD.

I'm testing this library, I'll let you know.

This refactor I've made is a bit "strong". If you want I can pull my mods as a request, otherwise I will start up a new project. Keeping the MIT LICENSE and reference to your original project.

zifnab87 commented 3 years ago

Thank you for the explanation - ok I will have a look and possibly the next weekend I will make it work with 1.8. Test is failing since I had a big performance issue with unneeded joins - so I succrificed a feature for performance

On Mon, Mar 22, 2021, 23:47 sb-davidegironi @.***> wrote:

Here (master branch) you can find the refactored project, based on the your master branch: https://github.com/telemedicacloud/spring-boot-rest-api-helpers

The only test that is not working (even in your master branch is not working is reference_test_conjunctive_equality_in_list__fetch_actors_that_have_played_in_all_movies_of_query) Speaking about tests, JSON has to be changed cause values in query need to be comma delimited.

  • pom.xml now includes only the "com.github.openjson" dependency, the dependency is included in the jar package.
  • No @bean https://github.com/bean is required
  • org.json was abandoned cause to his licence clausole ("The Software shall be used for Good, not Evil."), and compatibility issue using this library in production
  • Java version is 1.8

This makes easier the integration with other webservices.

In samplecode folder you can find the Generic Controller for Spring Boot and dataprovider for RA, with the full CRUD.

I'm testing this library, I'll let you know.

This refactor I've made is a bit "strong". If you want I can pull my mods as a request, otherwise I will start up a new project. Keeping the MIT LICENSE and reference to your original project.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Nooul/spring-boot-rest-api-helpers/issues/18#issuecomment-804417763, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEAN3SX3T3OZ3DOCC53OKDTE63IDANCNFSM4ZK57DOA .

zifnab87 commented 3 years ago

yes please make a pull request. Thank you

On Mon, Mar 22, 2021, 23:47 sb-davidegironi @.***> wrote:

Here (master branch) you can find the refactored project, based on the your master branch: https://github.com/telemedicacloud/spring-boot-rest-api-helpers

The only test that is not working (even in your master branch is not working is reference_test_conjunctive_equality_in_list__fetch_actors_that_have_played_in_all_movies_of_query) Speaking about tests, JSON has to be changed cause values in query need to be comma delimited.

  • pom.xml now includes only the "com.github.openjson" dependency, the dependency is included in the jar package.
  • No @bean https://github.com/bean is required
  • org.json was abandoned cause to his licence clausole ("The Software shall be used for Good, not Evil."), and compatibility issue using this library in production
  • Java version is 1.8

This makes easier the integration with other webservices.

In samplecode folder you can find the Generic Controller for Spring Boot and dataprovider for RA, with the full CRUD.

I'm testing this library, I'll let you know.

This refactor I've made is a bit "strong". If you want I can pull my mods as a request, otherwise I will start up a new project. Keeping the MIT LICENSE and reference to your original project.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Nooul/spring-boot-rest-api-helpers/issues/18#issuecomment-804417763, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEAN3SX3T3OZ3DOCC53OKDTE63IDANCNFSM4ZK57DOA .

davidegironi commented 3 years ago

Hello @zifnab87 I've made a pull request from my personal github. Hope this helps.

zifnab87 commented 3 years ago

This commit should resolve the issue with java version - please let me know if there is anything in the current master that is conflicting with you. I made the least amount of changes possible that's why I decided to not merge #19. If you can make a pull request with sample-code folder and readme.md changes only I can merge so you can take credit . Thank you

davidegironi commented 3 years ago

The thing is that using spring-boot-starter-web, lombok, org.json:json, commons-text and jackson-dataformat-csv as dependency may occurs in error while using this project in other project that does not use those library. This is the reason why I removed all those libs from my fork. Anyay thank you for merging a few changes from my code.

zifnab87 commented 3 years ago

@davidegironi please let me know which of those actually cause problems - so I can see what I can do. One of the biggest complaints I have and others (previous issues) is by inclusion of spring-security which is honestly a must for any serious production API - is that it is making all the endpoint to be Forbidden if there is not whitelisting policy. So I had to remove it. Thanks for your time. I hope we can narrow down anything that needs to be removed (I believe you can always use exclusions too ) and add later on sample code for react-admin. I had a repo that was combining the two with java and react-admin code to serve both and see it live but it is seriously outdated

davidegironi commented 3 years ago

From my test is org.json:json, but that's because all the other I've already imported in project or I call functions that does not use the dependency. As for "samplecode" i think the fastest thing will be for you to download the code from my git, and paste the folder to your git.