Generate jar with Spring Boot [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to develop an application with spring boot that generates an executable jar. And use database connections and use external properties Is this possible?

This link will be helpful. It depends on what build tool you are using.
https://spring.io/guides/gs/spring-boot/#scratch
For configurable properties , refer to application.properties file in spring boot.
https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html

Start with Spring Initializr. I'd recommend using Gradle for your build.
https://start.spring.io/
Add JPA as a dependency. After downloading the project, add properties to the src/main/resources/application.properties file. Look at the following link for "spring.datasource" specific properties to configure your Database connection.
Running the following command will create an executable Jar in the build/libs folder.
./gradlew build
I'll need more information about your full intent if you want to "externalize" your properties. You can start here:
https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html

Related

How does Spring boot Application runs under the hood? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am new to spring boot and for build tool i am using Maven .
I wanted to know that how does spring boot application runs after maven build process finishes like
What is the output of the build ?
How build is executed ?
Although much of the detail about the build and run process is abstracted away by IDE (like IntelliJ) but i am curious to know about what happens internally ?
The spring-boot-maven-plugin Maven Plugin can generate an executable JAR which includes all dependency JARs and start-up, classloader code in addition to you application code.

How i can build only one JAR-File which is containing several different application/subprojects? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I just want to create several Spring-Boot applications. But I want to create them all in the same project in parallel. At the end, when I'm building all the stuff via maven just one jar-file should be created. One Jar file which is including all applications.
(Optional: not sure if that is even possible) Each project should have its own pom file and artifact id.
To start a particular application of this one jar file, I want to add some profiles (or something similar, special parameter) so that I can simply start a subproject by given parameter or profile.
I just started with the answer i already got. Made the subprojects, but here every subproject is created in an own jar file. That is exactly not what i want ;).
You have an idea?
Tanks a lot in advance.
ps: I'm using IntelliJ IDEA
Yes, you can do it.
For this you can build different individual spring-boot project and accumulate all project into one parent project. Then, you can use your every project individually also can use as a parent jar file.
For more details multi-module-maven spring-boot-multiple-modules

Spring boot Data source config with JPA [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
For now I am fetching the Datasource properties from the application properties file in spring boot. I want to fetch the data source properties from the DS.xml file placed at the external location on the tomcat 7 server. I want this to be a JNDI based configuration. I am using the JPA repository so it possible to do this with minimum changes to the code.
You can do, but you need to run the application as below command:
java -jar -Dspring.config.location=<external-config-file> myBootProject.jar
please refer the bwlow url for details:
externalise guide URL
You can always use JNDI to configure your data-source with an
application server (like tomcat, weblogic) and then within your app
fetch that data-source and use it.
Some application servers like weblogic provides you a way to config it with GUI and some don't

Configuration of jBPM in Jhipster [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I am new in Jhipster.I want to use both jBPM and Jhipster.I am not able to call even simple jbpm process using Jhipster.
Firstly I tried to run simple jbpm process through rest API call it gives me an error H2 datasource not defined.
At second time I tried to run simple jbpm process where I used persistance.xml for jBPM database connectivity then I got an error as No Persistence provider for EntityManager named org.concreatepage
Please help me to come out of it.
Thanks.
We implemented it, for one of my customer, so I can't share any code. But it is pretty simple.
All steps you can follow:
First, generate a JHipster project with simple configuration (no MongoDB, Cassandra, etc)
Look at the code at this repository https://github.com/mswiderski/jbpm-examples/tree/master/spring-boot-jbpm
Add dependencies, config xml files, etc.
Alternative solution would be to use Activi:
here the ticket: https://github.com/jhipster/generator-jhipster/issues/6454
here the module: https://github.com/Activiti/generator-jhipster-activiti

Add packages to a Tomcat server [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I'm creating a servlet-based application using Tomcat.
Besides that i've some classes to acces a DB with jdbc. (present in a other folder/package)
I was asking myself how to integrate them cleanly in my servlet-based application.
What's the "cleanest" solution ?
thx
I would go with packaging as a separate JAR file and placing in WEB-INF/lib of your web app.
While it may seem easier to just put JAR to the common libraries folder so that several web apps start using it - it will result in not being able to upgrade the JAR without restarting the whole server. Also you will need to make sure that the new JAR is working fine with all of the apps. Classpath issues are possible with this approach too.
Package them in jar files and then add files to you're project.

Categories