From 8b57598be0ef096bf8cbc965d29434a8e14b6cc5 Mon Sep 17 00:00:00 2001 From: Eugen Mayer <136934+EugenMayer@users.noreply.github.com> Date: Sun, 29 Jan 2023 00:27:24 +0100 Subject: [PATCH] Migrate to spring boot 3.0 (#69) --- .run/ConverterApplication.run.xml | 9 ++++++++ README.md | 30 ++++++++++++++++--------- build.gradle | 8 +++---- gradle.properties | 2 +- settings.gradle | 9 ++++++++ src/main/resources/application-dev.yml | 4 ++++ src/main/resources/application-prod.yml | 5 ++++- src/main/resources/application.yml | 6 ++--- 8 files changed, 52 insertions(+), 21 deletions(-) create mode 100644 .run/ConverterApplication.run.xml diff --git a/.run/ConverterApplication.run.xml b/.run/ConverterApplication.run.xml new file mode 100644 index 0000000..0094459 --- /dev/null +++ b/.run/ConverterApplication.run.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 657d4c0..8dee88b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## WAT Offers a (i think production ready) REST service to convert files like PDF, docx,xlx .. odt .. you get it.. to other formats like pdf, png, doc, pdt, html. -This project is basically an extended version of [jodconverter-sample-rest](https://github.com/jodconverter/jodconverter/tree/master/jodconverter-samples/jodconverter-sample-rest) +This project is basically an extended version of [jodconverter-samples-rest](https://github.com/jodconverter/jodconverter-samples/tree/main/samples/spring-boot-rest) You can use this project as it is using docker with `ghcr.io/eugenmayer/kontextwork-converter` or build it here yourself. @@ -59,7 +59,7 @@ This fires up a docker container, mounts your source. To auto-rebuild and auto-r ## Debugging -Of course you can just start using your IDE and debug that, but if you want to debug inside the docker container +Of course, you can just start using your IDE and debug that, but if you want to debug inside the docker container make start @@ -76,20 +76,28 @@ CI based on tags ## Configuration -You can configure the docker images by mounting `/etc/app/application.properties` and put whatever you like into them. +You can configure the docker images by mounting `/etc/app/application.yml` and put whatever you like into them. For example if you like to have 2 LibreOffice instances, you would put into the file -```properties +```yaml # amount of libreOffice instances to start - one for each given port. So this means 2 -jodconverter.local.port-numbers: 2002, 2003 -# change the tmp folder -jodconverter.local.working-dir: /tmp +jodconverter: + local: + port-numbers: + - 2002 + - 2003 + # change the tmp folder + working-dir: /tmp # change upload sizes -spring.servlet.multipart.max-file-size: 5MB -spring.servlet.multipart.max-request-size: 5MB -# change the server port (where the REST app is listenting -server.port=8090 +spring: + servlet: + multipart: + max-file-size: 5MB + max-request-size: 5MB +# change the server port (where the REST app is listenting) +server: + portL: 8090 ``` ### Adding addition document formats diff --git a/build.gradle b/build.gradle index 268a789..631525e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,12 @@ buildscript { ext { // @see https://mvnrepository.com/artifact/org.jodconverter/jodconverter-local - jodconverterVersion = '4.4.5' + jodconverterVersion = '4.4.6' // @see https://mvnrepository.com/artifact/org.mockito/mockito-core - mockitoVersion = '4.11.0' + mockitoVersion = '5.0.0' - // @see https://mvnrepository.com/artifact/org.apache.tika/tika-parsers + // @see https://mvnrep1ository.com/artifact/org.apache.tika/tika-parsers tikaVersion = '2.6.0' // @see https://mvnrepository.com/artifact/org.projectlombok/lombok @@ -33,7 +33,7 @@ plugins { // @see https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web // changing that will upgrade spring to the corresponding version - id 'org.springframework.boot' version '2.7.7' + id 'org.springframework.boot' version '3.0.2' // much better output during running tests // see https://github.com/radarsh/gradle-test-logger-plugin for configuration options diff --git a/gradle.properties b/gradle.properties index b5ceb0a..da13627 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ org.gradle.caching=true #org.gradle.parallel=true -org.gradle.unsafe.configuration-cache=true +org.gradle.unsafe.configuration-cache=false diff --git a/settings.gradle b/settings.gradle index 7279fb5..2e677e3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,10 @@ rootProject.name = 'officeconverter' +// Composite build for library development +//includeBuild("../jodconverter") { +// dependencySubstitution { +// substitute module('org.jodconverter:jodconverter-local') using project(':jodconverter-local') +// substitute module('org.jodconverter:jodconverter-remote') using project(':jodconverter-remote') +// substitute module('org.jodconverter:jodconverter-spring') using project(':jodconverter-spring') +// substitute module('org.jodconverter:jodconverter-spring-boot-starter') using project(':jodconverter-spring-boot-starter') +// } +//} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 3f5c0ef..150fca8 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,4 +1,8 @@ --- +spring: + config: + activate: + on-profile: prod logging: level: org.jodconverter: debug diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index fbd7620..f40eebe 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -1,2 +1,5 @@ --- -spring.profiles: prod +spring: + config: + activate: + on-profile: prod diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 2a3d754..d480f69 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -2,9 +2,6 @@ server: port: 8080 spring: - profiles: - # that is our default profile - active: prod servlet: multipart: max-file-size: 20MB @@ -17,7 +14,8 @@ spring: jodconverter: local: enabled: true - port-numbers: 2002 + port-numbers: + - 2002 working-dir: /tmp format-options: html: