From Zero to Spring Boot Hero with GitHub Codespaces

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody welcome back to spring one i am so excited about our next talk it's uh it's about from zero to spring boot hero our two speakers are martin lippert and sandra allgrum folks take it away welcome everyone we are so happy to have you with us yes we really make it from zero to springboot hero with github codespaces so we're gonna start with no project setup at all we're gonna install all the needed extension program a little bit springy stuff and then we will publish it to the cloud we'll also add some tricks and tricks some tips and tricks here and there and i'm here with martin the lead for springboard tourettes so i'm very very happy to have this drawing session um slide wise uh sorry we don't have much slides it's a full demo session so why don't we start it right away so i'm here in my github repository i created in github organization or in github enterprise and you can do a free trial as i'm doing here to to give it a try give code spaces a try codespaces is a full ide inside the cloud for me so i don't need to have anything installed on my machine to use it which is very very cool and also if i would need something more powerful for heavy workloads or anything like that i could also just take a code space give it a powerful machine and then make that one so the repository name will be head of spring one like this and i'm giving it a readme and it's going to be all public so you also can exit it you'll find it under github.com java minus advocates so i will create this repository nice and easy just like that you probably already heard about this trick where you enter dot and then a code space would open that you can do or you go the way where you click on code and then create a new code space from here so this one will set me up a codespace environment so again it's an ide inside my cloud background but i didn't have to register anywhere so i'm just using my github enterprise or the github teams here so i hope that's big enough so that should be at least so here's my empty project and what i want to do is kick it off with this spring tool so i will totally go with the springboot extensions install them and i will also use the java extension pack and as i said we're going from zero to hero so i will also deploy it to any cloud and in my case i will use the azure cloud for it with the famous azure spring cloud we've heard so many sessions or referred i don't know three times today already but yeah as i said it's just any cloud you can use so all my extensions got installed oh no it says i'm having an error but yeah i mean it should look good okay so now i can create a new project and i'm looking for the welcome screen for my um for for the spring tooling so it should be at help welcome so here it is welcome add spring vs code yeah so don't miss that app it says vs code but you're inside github but yeah it looks a lot like vs code and it should actually also be the whole same experience so let me check again what's going on with my spring boot extensions oh i was probably too quick so i'm just making sure that it got installed again so now i can create a new spring boot project either from here or i open up the command palette with command d shift and p so i'm using the spring version just the latest and greatest stable version i'm going with java here and leave the rest as it is going with ja java 11 is fine and here for dependencies for this example we are going to use the spring web extension as well as the actuator to get some very nice custom endpoints for monitor and monitoring the application and the azure support okay so that's all the dependencies i need i will go with this workspace and add this repository to my workspace here in codespaces so as you can see it generated a full project for me a full spring project i i also use this start.spring.io but i don't have to go to a browser i can just do it in my ide as well so that's very cool i think and it gives me the same capabilities like onstart.spring.io so here's my demo application i can just run it from here and also here's my test and one thing i want to point out is yes we installed the java extension but it's not used yet so the code highlighting comes from a tool which is always pre-installed for code spaces called anycode which gives me a very nice view but to actually run and debug i want to switch to standard mode to enable the java extension so i'm doing that right now and yeah as we already installed the string boot tooling i should be able to see the outline here and gives me the the main endpoint also here for my spring project so now the java support is integrated so i can easily run my project from here cool and i can also open that up in my browser and here you can see i even got a new ad for this i could also share so why don't we program a little bit so let me add a hello world controller so you see it's also doing autocompletion and now i can add the rest controller also works with shortcuts and now use the get mapping method so it created the whole boilerplate for me so i can now easily enter some values here um oh enter the return type which is going to be just simple string and then enter the name here martin should we go with hello world or hello spring one what is cooler hello spring one of course i want hella spring one okay let's do that okay save that stop it here we run i could also go with maven here but i can also just press one or go with f5 okay so up and running again you can open that up in my browser and go on my url i just specified there we go and a spring one so that was quick and easy i think we are now like i don't know five minutes on time and i already created a complete no new project i have my ide set up with all the extensions so that is very quick and easy i can now save my code in git so i can just um use here the commit source control capability or i stick with my terminal that's totally up to your so i will just go with the terminal init project and go with git push so all my colleagues and everyone can now access this code but what i also want to make sure is that martin when he opens up opens up this project that he has all necessary extensions installed that totally makes sen makes sense to bind the extensions you're using to the code space because remember codespace is like vs code so it's you can program in almost all languages i just learned in the last session with uh josh long and leila and julian that you can actually also program kotlin in vs code wasn't aware of this but yeah as i said let's make sure that everyone else also can have the code spaces set up correctly with the extensions we already installed so i will just um go with them and add a development container configuration file here so i go with java and 11 so it already will go with x with the extension pack and i use maven as well so there are some things missing first of all the settings so as when you remember we switched to standard mode so let's do that as well then martin doesn't have to do that also standard and then the extensions so here we have the java pack already but we also need the spring boot one and make sure you have the full package and then we can go with the microsoft azure tools as well let's see and if you are not sure which one to choose you can also go again to the extension menu and then search here for the specific one you've installed and then here and at more info you can find the identifier so you can also copy paste just this one into your dev container to make sure that it it got um configured correctly for everyone else creating the code space or if you want to shut down the code code space and then we use it that you have everything installed from scratch so i also want to go with the spring cloud so let's see what the identifier is here all right and when i have this i will push it again commit and push so that martin can use it all right and with that my martin do you want to take it over and i'll do the deployment later on yeah that sounds great let me share my screen so that i can show stuff that's what i'm doing here wait a second so because i'm very sure that i missed a lot of tips and tricks from the spring tooling part so you probably have something and i've also heard you that you can actually use code spaces not just in the browser is that correct yeah let me let me first kick off a browser session and then i will jump over to my to my desktop installation what i think is very cool about this is that xander configured everything so she made up a project she configured everything she was she defined basically how my deaf environment should look like and i don't need to install anything locally on my machine i don't need to think about which java version do i really need and whichever do i not need and do i have maven installed or not it is basically setting up this container environment for me and this is what happened a moment ago so setting up a container in the cloud for ma for me myself so it's not the same container as xander was using it's kind of this a new container for me but configured in the same way so i see as you can see here the spring tools are already installed java tooling is installed so i could just go ahead and hack on this project and do stuff myself in my codespace but pre-configured with all the stuff that i need so you will see there is the java extension coming up here i'm doing the java tooling as we saw that with under same with the spring tooling and stuff like that so it's basically all the same and this is really great if you want to share the stuff among your team or if you want to kind of push a project onto github and tell people what should they really use and how should they configure things to get started right away without dealing with local installs or whatever so i think this is uh so this is really really really cool you can see the job project is here spring outline is here i could even run run the project over here as well um which i think is is really really really nice but there's there's another angle to that that's already mentioned a little bit which is that some people don't really like to work inside of a browser window for real coding work day in day out maybe because they're kind of shortcut overlaps with the browser or things are not exactly the same so what we can do here is that i jump to my vs code and this is my vs code that i installed locally on my machine so this is my pure vs code as many many people around the around the world use that and there is an extension called github code spaces that you can install and once you have that and the remote extension installed you can actually go here and see what are my code spaces that i have available in running and this is my codespace that i just created a second ago and i can now connect my local running vs code to this codespace so this sort of combines the benefits of hey i have my bs code running locally on my machine and it still feels like a real native locally running ide and the development environment itself is still running in the cloud in this dev container machine that is running somewhere and i still get all the extensions installed that i need they're all running in this dev container so it feels basically like the same that we saw in the browser but with the feeling of a real local locally installed ide so again it opens up the same java projects does all the same stuff even if i have a plain brand new bs code installed locally without any extensions installed except for the github one so which i think is is is pretty nice and so what you can see here for example is that springy tools are showing up so if i want to look for specific things i can take a look at all these symbols all the springy symbols get an overview about stuff of my spring project so you see all the the spring tools and the java tools that you're familiar with from vs code they still work the same in code spaces which i think is is pretty awesome cool thing is i can even run the app so let me just run this stuff here um so it kicks off kicks off the application and this this might sound a little bit a little bit strange because you don't really exactly know where where does it run but it runs inside of the dev container inside of the cloud so where the the real dev container is running but it forwards the port locally so i get a local port forward to my machine from these from this ide combination so i could go here and say what did you use to use hello right hello spring one so that's the app that is running i could do more more fancy stuff with the springy tooling i could for example also go here and connect connect to this application to get some some live information but in order to do that i would need to configure actually the app in a specific way we can do that but it's basically the same that you see in your local running ide and stuff that you're familiar with um so this gives you really the choice and the option say hey i can do it locally in my bs code i can go to the browser and in both ways the same dev environment is pre-configured for me which i think is is pretty awesome do you want to kind of show some some deployment stuff to azure yes i'm ready to go from here cool so let me share my screen again i think we still have a few minutes left so would be great to see that so as we saw i added the azure to it so i do have azure here i just signed in and now i have two ways where i could um upload my app one of us one of this could be app service i will just go and use the workspace and then create a new web app or use the existing one and then deploy it to app service or i go with the famous spring cloud here's a spring class die a spring cloud cluster i have already set up i think you're all aware spring cloud is the abstraction from um aka from kubernetes for me so i do have a full running kubernetes cluster in the background but everything nicely um hidden for me so and here i can actually deploy my app as well so i will just go and select the workspace oops and let's bring one demo target and okay so i need the jav5 first so i can just go with maven install or maven package and then skip test that saves us some time oops i need to be in the correct folder and then we do that and once my java is built i can do that and in the meanwhile i could also as we said we are here in codespaces i could also change my machine type so if i know that i do have heavy workloads i could have also chosen more cores on my more ram but let's not do that right now so my java file got generated so i will go ahead and deploy my app and yeah and once it's deployed i can also do start streaming logs so i can see my logs from the app inside here and i could also access the public endpoint and check if my app is already up and running and yet there this one is an old one because we just created in hello spring spring one app so let's redeploy so i go on deploy and then choose the correct demo folder target and now we have the jar file so now it's getting deployed it should be quite quick i mean in the real world scenario you just do that probably one two three times and then you have a cicd circle which was which was which would follow with get push or you have a github action in place which would do the deployment for you but yeah you can also do it all inside your ide which i think is very cool and you can also connect to your databases or inside codespaces as you are used to vs code so it's now updating the deployment should be there in a few seconds so let's see you can also stream the rocks again see what's happening while you're doing that sandra there's a question on the slack channel about github code spaces is that available for enterprise edition only can you shed some light on that yeah so it's available for enterprise edition as well as for github teams what you can do and what is free is code spaces live so i think you have already seen that if you go on github to any repository you can just press dot and then you would end up in something like this but this one is all in browser so now i can access the public endpoint as it got deployed now so i can go to my pass and see hello spring one but this time i'm inside my azure cloud and not just on the local or on the github local machine cool awesome should we switch back to the resource slides and the final thank you because i think we we walk through basically from nothing on your local machine just the browser installed to creating spring boot projects hacking on code using all the springy tools nvs code online in the browser locally on my desktop machine combined and even deploy that and that's all in 25 minutes or maybe 20 minutes so you see it's a it's a real thing that you can use and i think it's a i hope you you like the session we have some resources on the slides for you stuff that you need to install or that maybe you want to install uh i think we'll share the slides somewhere so that you don't need to write down the urls now yeah and if you want to use the dev containers in vs code you can just install the github code space extension and then you're ready to go as well cool and i think that's that's where we are if you want to contact us feel free to ping us on twitter and if you want to learn more about springy tooling and all the different ides like intellij vs code and eclipse feel free to join us and hardy for a session tomorrow a one hour session about all the beautiful spring tooling in the world with that for my side thanks a lot for joining and i hope you like it yeah thank you so much please don't forget to follow us on twitter you can find me at screamhead or martin at martinlivet yeah and feel free to jump over to our q a channel you can find it if you go under the slack channel for q a and then there is the link for the zoom call thank you so much talk to you soon thank you well sandra martin oh my gosh i've got new toys to play with i'm excited so guess what i'm doing i'm pressing the dot and we're going to i'm going to start playing with some apps out there so thank you for sharing that with us so folks please join martin and sandra and uh the zoom chat you can find that on your slack channel and join them over there and ask them questions and learn all the good stuff about that up next jennifer jennifer reef will be covering code wars database decisions for application development and that my friends will be joining us at 305 pm eastern so look forward to seeing you then you
Info
Channel: SpringDeveloper
Views: 1,489
Rating: 4.8857141 out of 5
Keywords: Core Framework, Testing
Id: uNnsP6nS49M
Channel Id: undefined
Length: 25min 33sec (1533 seconds)
Published: Wed Sep 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.