Server required in eclipse for spring boot - java

I am new to spring boot and I would want to know the basics of it. I am creating a project with jHipster. When I install gulp on my system I can see the project running at port 9000. I however want to deploy the same application on my local using tomcat apache server.
Can I debug my code in java using the same server installed during the time of spring boot or do I need a separate server like apache?

From JHipster documentation "Profiles" :
If you're using Maven Wrapper (mvnw)
./mvnw package
If you're using Gradle Wrapper (mvnw)
./gradlew bootRepackage
Should produce WAR with development profile as
By default, JHipster will use the dev profile
I think you can deploy this WAR on your usual Tomcat

Related

Interacting with Spring Boot + DynamoDB

I'm struggling to learn how I go about building, packaging, and deploying a Spring REST API locally so that I can interact with it? Ideally, I'd just like to GET and POST data as practice -- specifically integrating with DynamoDB.
I've cloned this DynamoDB project and built it using mvn package so that I have a jar file. I moved the jar file to the webapp directory of Apache and started the server, but I cannot interact with the API in any way. The project is structured as follows:
Once Apache is running with the jar in the webapp directory, I've tried accessing the API at:
http://localhost:8080/
http://localhost:8080/springbootapp (from server.contextPath=/springbootapp in application.properties)
Each gives a 404 error. And yes, DynamoDB is running locally. So what do I need to do differently? How can I deploy and access this API locally?
The project you have cloned is a spring boot project, hence you can use mvn spring-boot:run to run the application locally.You can also run it by running the com.baeldung.Application class as a java application from the IDE. For more details on how to run a spring boot app you can follow this link. Spring boot parent has a dependency on the embedded tomcat, which will run the application.
Additionally if you want to deploy the application as a war the spring boot documentation shows how to do it.

Springboot profiles for externally deployed war

I have a springboot application that is deployed to an external tomcat server, everything works in my local with local DB. Now, i have to promote the code to higher environments where the DB configurations are different. I read a lot about profiles with -Dspring.profiles.active=dev etc.., but how will the spring project know which server it is in when its an external tomcat and not using
java -jar -Dspring.profiles.active=dev demo-0.0.1-SNAPSHOT.jar
You can pass the SPRING_PROFILES_ACTIVE=dev environmental variable using CATALINA_OPTS
Here is all the ways to externalized properties and setting profiles docs
You should link spring boot profile with maven one like this .
Thus you can build your jar package specifying the spring boot wanted profile :
mvn clean install -P Prod

How to deploy web application to existing Jetty using Maven?

Using mvn tomcat7:deploy I can deploy a web application to Tomcat. But how can I do this with jetty? As far as I understand it, the Maven Jetty Plugin launches its own Jetty server but can I configure it to use my existing Jetty server?
You can use the Jetty Maven plugin with either the run-war or deploy-war tasks.
http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#running-assembled-webapp-as-war

JBoss and IntelliJ - Use Jboss Plugin to run and deploy or use Maven

I am a newbie in setting up a Java EE application in IntelliJ. I manage to make it work and deploy it using the plain Run Configuraiton > JBoss settings. But I want to convert my project into a maven project. I would just like to ask the difference between:
(1)building and running a web/ear application using IntelliJ Jboss plugin and creating a server run configuration, and
(2)using maven + jboss maven plugin to build, deploy, and run the server
Can I use the features of the IntelliJ JBoss plugin if I deploy using maven instead (such as hotdeploy and viewing the output of the server directly in intellj)?
Thanks a lot!

How to deploy Java EE application using Jenkins CI?

I have Jenkins CI configured with a SVN repo of our Java EE based application.
I am able to build the application but I am facing problems while deploying the war. Actually I don't have any idea how to get a war file out of the build and deploy it to a remote Tomcat 7 server.
I need to deploy this code to Tomcat 7 in the form of a war deployment. Please guide me through any tutorial or docs.
If your build is Maven based, you could use the Maven Tomcat plugin. This will do more or less the same actions as the Jenkins Deploy plugin, but it will add a dependency on your build tool and not on your continuous integration tool.
There's a plugin for that: https://wiki.jenkins-ci.org/display/JENKINS/Deploy+Plugin
Basically, the deploy plugin will use tomcat's built in REST API/manager application to deploy the war file.
I use this in anger, and it's pretty simple. The plugin does everything you'll need for a simple situation.
If your needs are more complicated than this, you can script access to the management REST API directly, but I advise you to start with the plugin.

Categories