I want to run and deploy a java rest API code on Bluemix. This is more to understand the Devops capabilities in conjunction with API management.
I tried to use this: http://www.codingpedia.org/ama/tutorial-rest-api-design-and-implementation-in-java-with-jersey-and-spring/
But could not push it to Bluemix. May I get some support?
Update:
When I push it to Bluemix, I get an error saying it could not find appropriate runtime.
Reading your comments you are searching for some pointers to create a starter Java REST application (possibly integrating a delivery pipeline).
You can start creating an application on Bluemix using the Liberty for Java runtime. Then you can, from your application dashboard, click on "Add Git" to create a Git repository on IBM Bluemix DevOps Services (IDS). Now you have your starter application running on Bluemix and its code hosted on IDS. You can edit the code directly on the Web IDE of IDS (clicking on "Edit Code") and from there push the new versions of the applcation on Bluemix or you can clone the repository on your local environment (for example using the Eclipse Tools for Bluemix) and deploy directly from your machine to Bluemix.
Using the first option you will be able to quickly setup a delivery pipeline using the "Build & Deploy" button, and use the DevOps capabilities of IDS. The Build & Deploy feature, also known as the pipeline, automates the continuous deployment of your projects. In a project's pipeline, sequences of stages retrieve input and run jobs, such as builds, tests, and deployments.
To add REST capabilities to the sample application you can for example use JAX-RS 2.0. Take a look here.
Javaee jax-rs REST API starter
Use my java REST API starter for bluemix. This uses javaee + jax-rs + swagger
Just fork it, run pom.xml to generate war and push the war file to bluemix. Works like a charm
https://github.com/sanketsw/jax_rs_REST_Example
Spring boot REST API starter for bluemix
if you want a spring boot REST API starter, you can use the following boilerplate. This is a netflix eureka client but you can ignore eureka annotations. The REST API will work seamlessly anyway
https://github.com/sanketsw/Netflix_Eureka_Client_Hello_World
Another cleaner springboot REST API starter is here: https://github.com/sanketsw/SpringBoot_REST_API
Related
I have built a few Talend job using cloud application's API and I was wondering to build it as a webservice to put in the cloud like for example in AWS.
For standard Java application I'm used to have the capability to build a .war and deploy it inside a Tomcat for example. But I can't find any proper documentation to build a talend Job as a webservice in 7.x (and AWS if someone has any clue what to do precisly !).
Thanks
You'll need to use talend open studio for ESB and use components like tRESTRequest and tRESTResponse as starting and ending component of your service. This will allow you to build them as kar file and deploy them in container apache Karaf.
I'm trying to bundle ReactJS and Spring Boot API together and build one fat jar. In every tutorial I read, I'm told to put the localhost API URL as a proxy in package.json of the React app like below.
"proxy": "http://localhost:8080"
As I obviously don't have PROD deployment experience with this, is this the way to go when you are deploying in PROD? Else, please guide me in the right direction. I couldn't find the answer anywhere.
Also, any cons in doing so in a medium sized project with two developers? Appreciate any input.
The "proxy" field should only be used in development environment when the Webpack dev server is first in line(to enable the Hot-Reload feature)
Here is a guide from 2018:
spring + react guide
regardless there are two main way of hosting the react app:
inside the spring boot Jar a static resource(you can use frontend-maven-plugin to run yarn/ npm again see the guide),
the advantages of this method is security, you don't need CORS enabled to serve the page.
the disadvantages is convenient this solution require more code, also the spring boot server handles UI serving to the client that requires extra calls to the server(spring first approach)
the other option is to host it in a hosting service like amazon S3 and then it will be hosted not in spring but in s3 and will be the first in line(UI first approach), you will need to enable CORS in spring boot app, but this is a more continent solution.
ps. I would read some guides first, it would help you with general understanding
I have multiple spring boot projects that a running on windows server. For now I am deploying each project as a windows service because we cant use docker.
Now I was thinking about to reduce the amount of windows services that I have but not change the microservice architecure.
One alternative is OSGi which seems to be very nice but as I have seen it is not recommend to use spring boot apps with OSGi.
The next alternative I was thinking about was to create my own java "controller app" that then can start/stop the other microservices. So only the "controller app" has to be deployed as a windows service.
Is there a better alternative instead of creating a own "controller app"? Docker would be nice but unfortunately we canĀ“t use it. Or should we maybe try to run our spring boot services with OSGi?
Is it possible to run Spring Boot on an Android device?
Right now I am successfully running a web service on localhost using Spring Boot which I've got building in IntelliJ IDEA. I need to get the same web service code running on an Android device. Is it possible to build the web service app into a JAR file that I can get running on an Android phone? I have a Google Nexus 6P running Android Nougat. I've done some limited research, and have found an application called JBED. So far I haven't been able to get this working.
I've started from scratch and built the example JAR:
gs-spring-boot-0.1.0.jar
and hopefully I can find a way to run this JAR. I'm guessing it probably won't work so if anyone has a better idea that would be great!
You can use i-jetty to host servlet based apps in android. or embed i-jetty (replacing tomcat or netty) in your spring boot app
Short answer is you're not gonna be able to directly run your spring boot application on your android phone. Spring boot is meant as a wrapper to quickly bootstrap Spring applications and is going to best serve you when building web based applications. As I see it you have two options.
Deploy your jar on the cloud somewhere(ec2,digitalocean, heroku, cloud foundry, etc.) and just access your Spring MVC app from the android browser. If you have some really complex logic in your boot app that you don't think you can port to android, you can still deploy your boot app in the cloud, and create a really "dumb" front end android application that consumes all of it's data from the spring boot app running externally.
Port you current spring boot application to a true Spring for Android project. http://projects.spring.io/spring-android/. The tools are out there to help you port it over all you have to do is put the work in.
There's an AnLinux app in play store that helps install a Linux distro inside termux.
I was able to install open jdk, spring cli and then run an spring boot project in that.
Here's a video I recorded demoing the same - https://m.youtube.com/watch?v=n9CY2wZPWJ0&t=1s
I have Eclipse Kepler installed and working properly on Mac OSX. I'd like to install Spring in order to design, write, deploy a RESTful web service.
I see a plethora of components listed on the update site, and little guidance on what I do/don't need in order to just get started.
Do I need :
SpringSource DM Server Tools?
Spring IDE Core Developer Resources?
Web Flow?
If you have Eclipse installed then just follow the tutorial: Building a RESTful Web Service
http://spring.io/guides/gs/rest-service/
It provides details of the Maven/Gradle configuration that you need which will ensure that the correct dependencies are imported.
Note that it makes use of Spring Boot, which in turn will import dependencies required by Spring MVC. You don't need Spring-WS for REST web services. Spring-WS is for building SOAP web services.