Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a simple spring boot java app example #21

Merged
merged 2 commits into from
Apr 1, 2016

Conversation

johnscancella
Copy link
Contributor

A very simple hello world using java and spring boot

@johnscancella johnscancella mentioned this pull request Mar 31, 2016
@afeld
Copy link
Contributor

afeld commented Mar 31, 2016

This seems like a lot for a Hello World app...was a lot of it auto-generated or something?

@jcscottiii Being our resident Java expert, mind taking a look?

@jmcarp
Copy link
Contributor

jmcarp commented Mar 31, 2016

There are a few spring examples in https://github.com/cloudfoundry-samples. Speaking of which, could we contribute our examples to cloudfoundry-samples instead of managing our own project?

@afeld
Copy link
Contributor

afeld commented Mar 31, 2016

Nice! Had no idea that existed. #22

@LinuxBozo
Copy link
Contributor

@afeld, couple of files were definitely autogenerated by gradle, the build runner. The core of the app itself is only 2 files, Main.java and HelloWorldController.java, and the test HelloWorldControllerTest.java

@afeld
Copy link
Contributor

afeld commented Mar 31, 2016

@johnscancella Thoughts about your implementation, vs. something like https://github.com/cloudfoundry-samples/hello-spring? Maybe we transfer this pull request there instead...?

@LinuxBozo
Copy link
Contributor

@afeld The difference between this example, and the example at cloudfoundry-samples could set off a holy war.. Maven vs Gradle. ;-)

Also, this example is Spring Boot, the other is Spring MVC. Both Spring, but slightly different. Boot is current gen tech, and can configure/integrate MVC.

@DavidEBest
Copy link

Given that some of the files are generated, is it necessary to include the gradlew and gradlew.bat files?

@jcscottiii
Copy link

@DavidEBest yeah you need those two. essentially, if you don't have gradle installed locally yourself, you can just run the one for your OS and it'll be fine


@Test
public void getHello() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.APPLICATION_JSON))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two options:

  1. you can remove the .accept(MediaType.APPLICATION_JSON) part
  2. or you also check the ContentType .andExpect(content().contentType()

@jcscottiii
Copy link

@johnscancella this looks good. :) just need you to also include the files from the gradle/wrapper folder

@johnscancella
Copy link
Contributor Author

@afeld Yeah it is a bit verbose, but I didn't want anyone to have to install gradle. If you(or @jmcarp, @LinuxBozo, @jcscottiii) think that is an ok requirement to install gradle I can remove them.
@jcscottiii thanks for the compliments, updated as you suggested.

@johnscancella
Copy link
Contributor Author

Ohh and @LinuxBozo yes definitely holy war when it comes to maven vs. gradle. I much prefer gradle, but if you think it will make a difference I can try and generate a maven pom file.

@afeld afeld merged commit a14c49b into cloud-gov:master Apr 1, 2016
@afeld
Copy link
Contributor

afeld commented Apr 1, 2016

This works—we can always iterate, and maybe transfer this to a spring-boot-gradle repository under @cloudfoundry-samples.

@afeld
Copy link
Contributor

afeld commented Apr 1, 2016

Thanks @johnscancella for the contribution, and thanks everyone for the input!

@johnscancella
Copy link
Contributor Author

no problem, glad I could help. +1 on merging with the cloudfoundry-samples at some point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants