 Well, hello and welcome to another Dev nation. We have another live session today. That's going to be super fun There's already a huge amount of you on the line with us right now What I want you to do is make sure you get your questions into our chat tab or Q&A tab I will try to answer as many in real time as possible and then we'll hopefully have some to save towards the end Also other members of the red hat team are here like John I see him online so he can also answer questions So do throw questions into into the chat tab into the Q&A tab and we're gonna really have a lot of fun today Now we're gonna be talking about this thing called Quarkus this supersonic subatomic Java where if you love Java and you want to see Java Running insanely fast insanely small and having a lot of fun while you develop it That's what Quarkus is all about and Georgios is here to show us the spring Variants, so if you're just in the spring APIs and what we've been doing in that category You got the right man for the job because he's gonna rock and roll right through that If you can't hear or can't see meaning you can't hear or see what I'm saying right now Refresh your browser and turn off all those ad blockers. That's the secret for this. All right. Let's turn it over to Georgios Georgios. You're up Hey, hey, bro. Hey folks. First of all, thank you very much for having me here Thanks for anybody for attending and Let's do it. Let's get the show on the road. So I know you've heard a lot about Quarkus through all these awesome sessions here So I'm gonna go through Insanely small amount of slides Really quickly since I know you've already heard all this great stuff about Quarkus I'll just refresh your memory real quick and then we'll go straight to the demo That's the plan at least so let me start sharing and Let's go alright So here we go Small amount of slides and then we'll go through the demo. Okay, so spring apps on Quarkus. What are we gonna show here? We're gonna talk about initially about Quarkus So, you know Quarkus from all the previous sessions that it's open source stack writing Java applications that usually target Like microservices or serverless environments anything cloud native The four main benefits of Quarkus that we've Iterated and we've talked about over and over again and we'll see A lot of these benefits today are first developer joy developer joy by developer joy we mean that You as developers as users when you use Quarkus We want you to feel that you are really productive that you really get your job done really quickly and have fun while while doing it We'll really see what that means in the demo second part which is super Important and I thought it's a super solid super sonic and subatomic Java what that means is that the applications you develop Will be very small and will be very well suited to be deployed to the cloud The third benefit is that the Quarkus unifies the imperative and reactive programming models We won't have time to talk about that today, but I'm sure you'll find some excellent material out there for Using reactive stuff with Quarkus and finally that Quarkus brings you the best of breeds libraries and frameworks and standards that you've Been accustomed to you all these years and that you've been using in your job applications in order to be productive You've probably seen the slide before and you you'll see some very big names out there I mean all the stuff that you typically use in all your Enterprise great job applications Quarkus really has you covered you'll see like micro profile You'll see hibernate. You'll see rest easy camel all the great stuff You'll see all the cloud native stuff Kubernetes open shift and in the middle there You'll see the spring compatibility layer, which is what we're going to be talking about and demoing right now So that was it for the slides. I hope hopefully I didn't bore you too much I'm sure you already know all this stuff. So let's get into the stuff that you Might have not seen yet. So what I'm going to do I'm going to initially create a Quarkus application using our command line tooling You don't have to use this command line tooling. You can just use code.quarkus.io Which is our excellent For code generation page where you can create a Project what I'm going to do here. I'm going to use a spring web Extension if you see here, I'm using the spring web which will create a Quarkus application that's already set up to use Spring stuff and I obviously made a mistake right off the bat. I used the wrong package name So let's do the Dev Nation 2 And that will hopefully work and I got it right this time. So I'll open this in my IDE and Let's see what we have here. So what this generates is regular beta project and the difference between this and the other Quarkus projects that you might have seen is that it adds the Quarkus spring web Dependency which is the dependency that we'll use to create for a REST API and Because it added that You won't see any JAXR REST resources for creating REST applications But you'll see is your regular spring controllers. So this is a spring controller that you would normally have and be used to if you're using spring boot or Maybe even spring frame or without spring boot So this is all just normal stuff. What we're going to do now though is kick off Our developer Joy and start being productive. So how do we do that? We do MVN Quarkus Dev. So what this does is that it launches the Dev mode. The Dev mode is the awesome mode that Quarkus has that allows me to write code and instantaneously see feedback see the results of what I'm doing without having to To restart the application at all. So I started the application here I'll go real quickly and make sure that everything work is working So this is a spring controller that it was automatically generated for me. It just returns a hello I'll change that real quick here in the ID. You don't do anything else. It's refresh and I immediately see that so You see immediately you see something that you're not used to in the spring world, but that you that Is so vital to Quarkus that you write your changes in the ID or your Whatever text editor you use and you immediately see the change. So go ahead and make this just the tab more complicated a lot of request param the request param here is that I'm just gonna add a query parameter. So request parameters what spring uses for query parameters I'm going to give a default value world which means that if I don't pass the query parameter There'll be hello world. If I go here and add Dev nation then it's hello Dev nation the instant changes that's all great But I'm just returning a string here right strings are boring So what we want to do is we want to return some JSON JSON is what every web service uses these days So I'm going to create a class say string let's say message and I'll create a constructor and My getters and everything and then here. I'll go and change the result to be a greeting and I just refresh and I Magically see this stuff happening, right? I am mad. I magically see Jason Just by writing this the spring stuff that I already know. So Let this sink in this isn't like Different spring than what you're used to this is you just write your spring stuff that you've No doubt have been writing for a while now since a lot of people use spring boot You just write this stuff and you're immediately productive and you're you're so much more productive than you're used to because of this Dev mode that Automatically allows you to see your changes. Let's make some more changes and make this Little more interesting. Let's say greeting service So a greeting service is what I'll use to like let's say encapsulate the business lives here I Back here, I'll inject this greeting service into into my controller Creating service create name and I think I did a fairly good job here Notice I didn't use any out inject here because this is a there's only one constructor so we can automatically use But that's what's supposed to be used just like spring. I refresh oops and I see an error on And that's great, right? That's great that I can see the error right inside the browser I see it immediately and it's the the error staring me in the face, right? You just tell the unsatisfied dependency of type reading service What does that mean? I mean I create a greeting service, but I forgot to make it a beam So all of us have made this mistake before it's all we do is just add a Spring a service annotation or I could use component or whatever. I like our refresh and I just see my changes And that that's great, right? So developer productivity and Phillip or George doesn't mean that only the happy path works Means that I get meaningful feedback immediately when I make a mistake And now I'm gonna top this off by let's say Making this configurable because I don't want this like this high thing to be hard-coated, right? So I'll just I'll make this configurable. I'll have a prefix And I'll go about wrong value Value is what we all know from spring to inject configuration so I'll go reading prefix and Then I'll add the prefix here And I should see more Awesomeness and I do see more awesomeness from carcass not for me that is Because I made a mistake. I said nope I Get immediately see what the mistake is I see no config value Exists for grading prefix and that couldn't be more odd, right? so I was the forgot to go here and Say greeting prefix is a lot a Lot of them nation so I made changes not only to the source code. I may change configuration They'll pick up immediately. That's pretty cool Maybe let's take it a step further and let's say I want to post something But I want to also have the validation on what I post So for that what I would do is that I would add a new dependency Which I'm gonna say which is gonna be the park is hibernate validator Which is going to provide me with the validation for my input. So let's say I go to the controller Public static class input And let's say I don't know what to call it. So I'll just call it field I'm not really Imaginative, but it'll do And then I want to I want to say I want to return it to me, but See like wrong input and I'll this would be input And this will be a post mapping because I want to post this post mappings with spring use these days And I'll make this valley and I'll add a constraint here Oh, I'd like a simple constraint like not blank. What that means is that when I post to this method Then I expect that the field will not be blank. Let's say new greeting Now since this is a post I can't really use the browser Without developing a UI that is which is something I want to do now So I'll go ahead and use a HT PI. This is an awesome command-line tool It's called curl. Some people call it curl for humans. So I'll just use that. I'll just go post local host 8080 Greeting and I'll say field is George So I post that and I get high from George, right? Because that's what I expected here now if I do a blank Field I should get I Should not get an HP 200 I'll get an HTTP 400 which is a bad request see and I got I didn't specify an exception handler anything So I just got the out of the box stuff which tells me that the input field was blank. So you see that All the stuff you're used to from Who spring web controllers arrest controllers just works out of the box right and it works great with partners That's cool, but you know without a database or anything. There's only so much stuff we can do So the next logical step is to use a database in the way we use databases usually in spring is to utilize the spring data GPA Abstractions so what we'll do here is we'll add one more dependency We'll cause we'll use the cork of spring data GPA extension and because I'm gonna I'm using I've Running an H2 database locally. I'll just add the H2 this is like the cork is extension to talk to H2 So that's the I've got that out of the way and let's go and create The book is the entity I'm gonna call it book. It's gonna be super simple. I'm just gonna add Integer VID, which is going to be the book ID And I'll give it a few fields. I'll give it name and let's say Integer year So those are the only fields I'm gonna have around some gathers here just to make the serialization easier Those are the only fields I'm gonna add and in typical Spring data fashion spring boot spring data fashion. I'll just I'll access this book From the database using a book repository. So this is the pattern that spring data GPA uses where you extend a repository You say which entity the repository is for and what the type of the ID is so book repository I don't have to write any code except this like just an interface that extends spring data GPAs correct repository And now we want to be able to access that So I'll write another controller. I'll call this the book controller Let's see request the rest controller or quest mapping and we'll say this is under book I'll inject the Pository Constructor ejection as we're told so often we should do and Public let's say I'll make this an iterable books. I'll say find all So I think I'm done with coding this but I still have the I have to configure Quark is to talk to the database. So what I'm going to do now is that I'm going to Paste the configuration already have some like I said, I'm talking to a local H2 database I'm gonna use the HD dialect and I'm just for the ease of this demo. I'm going to be dropping and creating database Quark is Every time I load a change car and now the saw some feature that corpus has is that it allows me to see the database really easily By adding some data to the import sequel file import sequel will allow me to just add a few sequel statements and so I can have some books to Interact with so these are the few books. I've been reading lately and I'll be using them to show that Hopefully the code I wrote actually works So what do we need here, right? All we need here now is to go to Book and hopefully I'll see all my books everything goes on and I do I mean I have the six books I added I can access them immediately. So let's reflect on this part a bit, right? You saw that I never restarted corpus All I did was just add a few dependencies Write my code and I immediately got access To the database like this was so easy took me like five minutes Maybe ten minutes to write something that is that utilizes apis that I already know And I love the spring apis. I see these are all spring Apis see what you see the imports. There's only spring stuff You go to the repository. You see only spring stuff here as well And corpus just worked out of the box So fast this stuff worked immediately So that's pretty I think is pretty mind-blowing We could do more stuff here, obviously, right? So Book control. Let's say I'll add another method. I'll call I'll say List like I would do spring trigger spring data GP. I want to add Some custom methods So I'm going to find my public case near between Integer lower Integer higher. So what this will be doing is um This will allow me to to query the database from books that are published between certain years Let's see how to do this get mapping. I'll say year I'll say lower Higher path variable Path variable correct Another path variable now. I'll say book repository lower higher So I'll go here again, and then I'll go year Let's say 2010 2020. I see all my books immediately. Like it's like I didn't even know that uh corpus Dev load was in player just worked immediately So and then if I want to narrow this down, I could say 2017 2018 Immediately. I have all my books here. So I think this is uh, I think it's pretty amazing Now, uh, one other thing that uh, we've heard about a lot about when it comes to corpus Right is that you can create a native image. Uh, a native image is um, is a The creation of native images Done by growl vm, which takes our jars and charge the corpus creates and they creates a native binary Corpus that makes that super easy to do. So all I would need is like mvn clean package I would skip tests You should do this But I'll just show this real I'm not gonna go I'm not gonna let it create the native image because that will take a couple minutes And we have better things to do and sit around wait Wait for this to complete in a couple minutes But what I wanted to show you is that you create with a simple command line flag Which is the minus d native. Uh, I could create the native image and corpus will take care of all the the Difficult things of creating native image with the growl vm So I'm not going to let that complete but what I'm going to do is that uh, I've already created it for you For starting a demo. So I'm just going to start it here Dev nation, uh, you saw this this Uh, you didn't even have the time to see how fast this happened So I started the application that let's sit Uh, let's uh, note this point. This is a spring Uh, a corpus application with spring api. So spring data jpa spring web It talks to the database and the h2 database and has hybronate validator and it started in 18 milliseconds I think it'll be very hard for us to see anything faster than that and let's just make sure it works I didn't do it. I mean, uh native image 18 millisecond startup time and let's see another great thing about it. Um, let's see how much memory it takes up and uh, let's So the resident set size for this was 42 megabyte 42 megabyte for database and java application that talks to database I think it's pretty amazing I hope y'all agree with that So that concludes the first part, but let's get a coding part of my demo The next part I wanted to show you real quick is that how does this What does this actually matter in a cloud environment? And what I'm going to do to try to show you this Is that I have uh, I've created uh with a burb really created this actually and I uh Let's say was inspired by it. So this is uh, it's the same application written in three different ways It's a vanilla spring boot application. So, uh, I'm using string latest from boot 2.2.1 It's just a spring application that returns some json, right? That's it But the other version of the application is the corpus application that basically use it. It's the same spring controller Um, but it uses the corpus stuff the corpus spring stuff that I showed earlier And it gets the corpus 101 final ladies version and I also have the same version of the application written to node j s Don't even ask me how I did this. I don't even know Since I'm not a node fan But I want what I wanted to show you with this is that a lot of people use node jf It has a low memory footprint and starts real fast So they use it a lot for the cloud. So what I want to show you is that how corpus compares to these two uh environments So what I have here for you is um, I'm gonna what I have here on the top of the screen Is a script that is um counting how many ready pods we have in our kubernetes cluster Oh, yeah, I forgot to mention that I've pre deployed this out with these three applications these simple applications two Open shift cluster for those of you who who don't know open shift is What is red hats uh enterprise Version of kubernetes So you can but you can just think of it as kubernetes. So I've deployed the spring boot application, which is on the left No js application in the middle corpus application on the right. I've deployed it to Open shift And what I want to do now is that because I'm using um Open shift serverless technology, which is based on k native what I'm going to do is I'm going to Simulate a burst of traffic and I'm going to see how quickly um My cluster can scale up these uh, these applications, which let's Say again, these are the same application one is in vanilla spring boot one's oj s one's corpus So I'm going to start simulating the traffic burst for the spring boot version Then for the node version and finally for the corpus version. So uh, the corpus is at a disadvantage here because I started the burst last But what I want you to Feast your eyes on is the top right the top of the script that's uh monitoring how fast these can scale up So we immediately see that Although corpus was the last one to receive receiving traffic it immediately scaled up to 13 um pods Without the other ones having scaled any uh to they just have the one pod now no js is coming up So you see how long it took for the other For no js to come up vanilla spring boot isn't even up yet. There's still one pod running So in a real environment, you would have missed all this if you were running with the vanilla spring boot You would have missed all this traffic And you saw that if the same application if you had it in corpus It would immediately start serving your large traffic boost at burst Let's see now the the spring boot is trying to come up So my open shift my open shift console here is showing me that there are a lot of pods running And spring boots are trying to come up, but they're not so and Take it you should know that this cluster is a fairly slow cluster, right? So these are starting up slower than they would but in any case the difference between the three types of applications are Would be the same Whatever type of cluster you have the other great thing to note here is that open shift will show me the top 10 memory consuming pods And you can see here that they are all from the vanilla spring boot. None of the quarkish Applications even makes it into the top 10 memory consumers What so you you immediately see that you have an application that runs That starts so quickly that you can actually Serve burst traffic and it takes up a lot less memory, which means that you can pack in A lot more of the instances of the application So I really hope that this whirlwind whirlwind tour of what we can do with quarkis and the spring on quarkis really Gave you the opportunity to see The power that Exists behind quarkish And what we've done With it so far So I I think I stopped sharing now So I think well we have all right when we have we do have a couple moments Questions for We do have a couple moments or questions And I think there's one one in particular that's very appropriate for you And that is how are we going to manage keeping up with the upstream spring? So if spring continues to evolve and move along how how what is your plan for addressing that? Yes I'm hearing. Yeah. Oh Well, we can talk this way So the question is how do we keep up with the upstream spring? As spring evolves and continues moving forward. What are your plans to continue keeping up? Okay, uh, do you want me to take this one or that you? Okay, great. Uh, okay, so the idea here is to We want to provide like the most common features for that spring developers use, right? Uh, we obviously can't compete like in brain every spring feature That that's out there But what we want to do is we want you to use the most common be able to use the most common spring features and be able to use them in a way that is like Let's say better than you would use vanilla spring boot in the sense that you have that that they're faster You it's faster to develop and uh applications you build are uh Have a much smaller runtime footprint. Um, no now We don't currently we have spring bi spring web and spring data dpa in a few days we'll have spring security support as well And then we have a lot of more stuff on the pipeline But uh, we really want to hear from the community like what the the most important things and most used things are From people what they want to see from this spring effort on corners Okay, and a question related to spring rest controllers. Do we have support for hate os or hadeos depending on how you pronounce that? Uh, yeah, that's uh, that's another we don't have that yet but that's one thing that we have heard from a few people and uh, like the more we hear from the more we hear from the community for The stuff then the easier it is for us to just find out you like let's Do go the extra mile and put this in Okay, and i'm just checking a couple other things Looks like we covered most every question that I can think of at least the ones we can cover in the time that we have remaining Because we are out of time, but I really enjoyed the presentation. I really love the demonstration. That was absolutely fantastic John clingham has been there answering questions also Uh, you did show things like spring jpa. So that's the at repository syntax I remember you covering things like that. So otherwise, I think awesome job here We had a huge crowd on the line today. I apologize if we missed your question They were coming in fast and furious, but do feel free to run uh, check out georgias on twitter And actually I will add his twitter account to the chat so you can check him out on twitter and find him there You can always come to the corkis Google group and that's where we all hang out and zealot group as john says right there in the chat Definitely bring all that to us and uh, please bring us your questions And if there is something in the spring universe that you truly must have and love Please let us know. We're very interested in hearing about that use case Again, thank you all for your time georgias awesome job as always. Thank you Thank you. Thank you burr. Thanks everybody for attending. It was it was great being here. Thanks so much absolutely everyone