How to integrate JNI shared library in Spring Boot application - spring-boot

I tried searching on the web but I could not find any relevant tutorial or how-to for integrating JNI shared libraries into Spring Boot project. I would like to integrate GDAL library with a small Spring Boot REST application.
Is it even possible to use JNI with embedded Tomcat?
Can someone provide links or an explanation on how to include compiled jar and actual library files into a Spring Boot project?
Maven would be a prefered build option, but gradle would work too.

I'm facing exactly the same situation.
My app has an embedded JNI library that i cannot to embedd at WAR file.
To run from Eclipse, it executes normally but for WAR file build it's not possible.
I believe that the solution key is about the repackage goal of 'spring-boot-maven-plugin' but I got few information about that.
Regards,

Related

Spring Boot App - Reference external code during runtime that isn't part of the bundled WAR?

I have a Spring Boot+React application that is packaged as a bundled WAR.
This works well for most cases, but we need to be able to drop-in functionality in some cases that is not part of the bundle (such as via a JAR).
I knew OSGI exists for this case, but not sure of any usage with Spring Boot. Is there another way to do this as well?
If your use case is a kind of small plugin functionality for your spring boot app then you could start an OSGi framework inside spring boot and load bundles from a separate directory. You plugins could then offer their service via an interface that is provided by the spring boot app and an OSGi service with that interface.
You need some good OSGi knowledge for this to work.

Making a spring boot fat jar file with gradle WITHOUT a spring boot gradle plug-in (no access to bootJar)

I have a spring-boot application in which I loaded all the necessary (or so I believe) dependencies to run without using spring-boot initializer or the spring-boot gradle plug-in. These tools are not available for me at my work. I can run the application through intellij without issues, but when attempting to run a fat jar, I am met with
No auto configuration classes found in META-INF/spring.factories.
Now the spring.factory files ARE located inside the fat jar (there are multiples of them) and they are inside the meta-inf directory.
Spring boot has so much automated functionality, I am not sure where to begin. There are a lot of similar posts and everyone just tells people to use the spring-boot gradle plugin bootJar task but as I said these are not available to me. I need to get it running without those tools,
if anyone has insight into what the issue may be or how to resolve it, any help is appreciated. I will try to add more details later.
I am using spring-boot v. 2.1.1 and spring 5.1.4

How to deploy gradle spring boot java war application into app engine standard (not flex env)

I have a project and I don't want to use AppEngine flex as they are expensive. So I converted my project to standard by converting spring boot application from jar to war
When I try to deploy the project to the app engine it is picking app.yaml rather appening-web.xml and deploying as a flex project rather standard.
Did anyone face the same?
Make sure your appengine-web.xml file is under the src/main/webapp/WEB-INF directory. Your structure should look lke this:
For more detailed information about the App Engine Standard configuration files for Java please check this documentation. You can also check the steps in this GitHub page on how to deploy a Spring Boot simple Hello World app in App Engine Standard.

Spring Boot JAR Distribution

I have developed my first Spring Boot application and packaged a JAR using Maven.
When I launch it on my machine, no issues.
When a different client launches it they will get an error if they don't have the same version of Java as I developed it in (Java 8).
I had made the assumption that everything would be packaged into a self contained JAR with everything it needs to run (like when I create native packaging with JavaFX).
Am I missing something? What are the best practices for distribution a Spring Boot JAR? Thanks in advance.

Can Spring Boot + Gradle generate a war file compatible with Servlet 2.4?

I've been reading about using Spring Boot and Gradle to quickly build RESTful services: https://spring.io/guides/gs/rest-service/. I'd like to give it a try but I need to build a war that's compatible with servlet 2.4 (I know.. life in the 1970's).
The error I get when attempting to deploy the war generated by following the guide above to Sun App Server 8.1 is:
Unknown deployable object type specified: "Cannot determine the J2EE
component type"
The generated war has no web.xml and there may be other expected artifacts.
Configuring a spring-boot application using web.xml seems to suggest that a web.xml can be packaged with a Spring Boot application but doesn't explain how.
Is Spring Boot compatible with older servlet specs? How can Spring Boot and Gradle be used to generate a war that works on older web containers?
Thanks.
The answer to the question you linked to didn't actually go as far as saying that you could easily create a fully-leaded Boot application with Servlet 2.4. I consider that quite a hard, but probably achievable, target if you are prepared to do some legwork, and accept some compromises. You might find this stuff useful: https://github.com/scratches/spring-boot-legacy (I managed to use it to push an app to GAE). But there are some limits to what can be supported for such old technology, and we aren't officially supporting anything other than Servlet 3.0.1 right now.

Resources