What Is Spring?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
good morning spring runners that's what i'm gonna call you the spring waters uh thank you so much for joining us i hope you all enjoyed the main stage setting us up for a great two days here we you are at the beginner friendly spring track i'm your host bob brinley i'll be here all day presenting with our introducing the presenters and we are excited to start the day off with our very first presenter a very good friend of mine and someone who's going to walk you through what is spring is the title please everyone welcome glenn renfrow well thank you bob for that wonderful intro and i am going to now give you the presentation of fun hello everybody um welcome to spring one so if you're saying i've heard about spring and i'm not sure what it is this talk is for you if you say you know i used to use spring many years ago and i kind of want to know where is it at now this talk is for you if you say you know what i've got an hour and i need to listen to something as i sip my coffee that's going to be relaxing well this talk is for you so with that being said let's go ahead and start our fun uh guys i'm still hearing you on through my screen yay everybody okay awesome so all right folks uh if you hadn't had a chance take a look at our safe harbor statement you can actually go in and do a screenshot of this if you want to and it's just basically our kind of our legalese is saying you know what we're talking about today is information purposes not to be incorporating a contract with that being said who am i well my name is glenn renfrow and i am a contributor and committer on spring cloud data flow spring cloud tasks spring batch and kind of anywhere they need me i'm a vmware engineer and uh also when i am not coding on these projects i'm on the board of directors and a volunteer for the atlanta java users group and also a volunteer and on board directors of an open source conference called dev nexus with that being said the first thing i want to do is go in i'm going really fast there i want to go in and say uh talk about how does the community feel about spring before we kind of go into what is spring well according to snick's 2020 jvm report exactly six out of ten java developers depend on spring brain framework for the production of their application that is a huge vote of confidence from the jvm community or the java developers out there that they would use a third-party market uh tool like spring in order to create and work on their production environment uh applications for their uh for their office but also spring's growth is accelerating when we look at spring uh we have this site called start.spring.io and basically start that spring dye io allows you to create just the foundation of your project like if you're using maven it's your palm.xml or if it's gradle it's your build.pro uh it's your build pro or build.gradle project it gives you just a sample test and your main file kind of a great place to do the kickoff of any project well in 2019 we had over 15 million projects that were started at start.spring.io don't worry i'm going to give you a little tutorial or show or demo on that in a little bit well from 2018 to 2019 we saw a 63 percent growth in spring project generations between 2018 and 2019 so what we're seeing is that growth is accelerating well if you're a stack overflow fan like me they produce like i think it's an annual report and they have one of the categories most loved framework well year over year spring went increased popularly went up by nine percent so we see that the growth is accelerating and this uh ecosystem is strong enough where people like it and they want to build projects on it if you're a stargazer on github that is um if you look at the spring boot project which we'll be talking a lot more about as a foundation to start your uh projects you'll see that it has over 50 000 stars now finally glenn is getting to the question at hand what is spring well i went to the sage phil webb who is the project lead on spring boot and he gave a talk about two years ago and he worded it this way i thought was really cool spring is an integration framework designed to take lots of different technologies allow you to combine them in ways that feel natural he further says it gives you a consistent programming model so let's think about it this way so not only spray and give utilities to reduce the amount of code that you are writing to give you high quality code but also in the way that it actually goes through and into spring infrastructure okay um i'm still i'm still getting some uh folks i can still hear you um hello everybody uh yeah i can hear you guys sorry you're welcome um hello hello hello hello what one second folks i apologize okay there you go i'm sorry folks i'm hearing i'm hearing multiple conversations here so let's get back to phil okay so with that being said um it gives you that consistent programming model so the goal is it's not only to give you the ability to improve uh uh reduce the amount of code that you have derived with the with great set of utilities but also it gives you that consistent model so whether what no matter what technology i pull in i'll be able to take advantage of those um i'll be able to take advantage of that again that consistent model between each of those technologies that i'll be pulling in so that reduces that learning curve so how did it all get started it's time for your history lesson and with that we had two folks rod johnson jurgen hall that were doing a lot of consulting and they utilized these patterns uh to uh with their customers to improve the outcomes of their projects and they were so successful that rod said you know what if i go in and i write a book about it but then they got together and said what if we take these same patterns and create an implementation of it and with that implementation was thus born spring the spring framework so some of the patterns that the spring framework gave us were inversion control and dependency injection what are those so for those folks that don't know it i'm going to give a brief uh um tutorial for those folks that know it hey check me for validation right here so with it inversion of control back in the day and this is like 2004 2005 i would have to when i wrote a project i would have to write the control flow for my project it was a lot of boilerplate on how the app was supposed to behave what spring framework did was they said what if you pull us in and we handle that control flow in such a way that you will write just classes or if you will beans that you will plug into our framework these beans would contain our business logic and so with that what i would do by plugging it in at the right time spring would call my bean to apply the business logic to do the business work if you will you would think of it as the idiom don't call us we'll call you i mean instead of me town spring run me this way spring says you plug in your bean to us and we'll know when to call it but no bean lives in isolation i would create many beans that do various business uh uh implementations and yet they need to be able to grab resources that they need right so if i'm using a bean that needs to hit off of a data source right i need i need to have that somehow wired into my beam well in the past i would have to go in and write the code to be able to wire that into my beam well with spring and the use of dependency injection what happened was is that i could go in and just say at my constructor time i need a data source or i could annotate a attribute in my class and say you know i just need a data source i don't care where it comes from just give it to me and what spring would do spring says hey you declared this dependency injection and you need it and this and this and this being and it would what we call wired in or auto wire it in so next right after that spring um would also provide utility so we didn't have to write all this boilerplate code and then they said why leave it there we can also give you tooling to be able to save you time as you write your testing and they also gave us a basic suite of database tools and they also provided us a way in which to write our web applications uh okay again for the folks that know at nbc give me 30 seconds or not everybody knows what it is so let's talk about it okay with that what is mvc so i need to create a web application and so what mvc stands for is model view controller it separates the various concerns of what it takes for me to create a web application so first the controller it's the middle person it is the one that's going to receive the request from the users and give them the response back so let's say it this way the controller receives a request from the user and that would be the controller would then pass that on to the model from that point the model would go out and grab the data from the database apply the business logic business rules or what and whatever it needs to do and hands that result back to the controller the controller then gives that data that came back from the model to handle it to to give it to the view the view then renders what the user expects the data to look like and kind of clean it up or whatever and make it into like a restful reply or whatever it needs to be hands it back to the controller and then again control being the middle person hands that back to the user so we see these three concerns well i went out and i said i want to show people what it looked like to write an nbc the old school where you had to go through and write the control flow and all that and the truth was i couldn't find one because no one writes them anymore and especially in java right so what they did so what i saw was is that people rely on a framework to do that for us and most so we don't want to write that right but spring said back in 2000 i think 2005 said what if we just allow them to create a bean that contains the controller like we see below with just saying hello world we then allow them to declare that being and then create a web xml so that they know what servlet the call and all that stuff so instead of writing literally what would be pages of code we could write it down into just three code segments so what we have just learned about is the history of spring we've also learned about what the basic foundations of spring the spring framework is so what does spring look like now oh well okay we've grown a little bit since 2005. okay and sometimes i even think it catches phil webb uh surprised we have everything from the spring framework that we created that to spring boot that allows me to build apps that work right out of the box but also spring data spring uh for you know simplifying the ability to get to that data uh our data via data sources spring cloud for working uh and helping us to make life easier for our micro services or web applications that were and applications that work in a distributed environment along with so many other projects but you're saying good grief where do we start well i want to categorize these things into individual units so you could say oh i go to here to look for this i go to here to look for that so first the spring framework jurgen haller talked about it he still works on it to this day and it's a vibrant living framework and it is the foundation for all spring projects so we look at spring and we say the next level was they said we want to create additional projects but we don't want to put them into the framework because they are in themselves use as need so we went and said okay the spring framework stays and it will be added enhanced and grows on its own but we want to create projects that will work off the spring framework things like security integration stuff like that right so with it we are we created these other projects that you can utilize to be able to build your applications we have the spring security spring security is a powerful highly customizable uh authentication access control framework it is de facto standard for securing web-based applications we also have spring batch we saw where many companies and customers were writing applications that were scheduled they would launch do their work and then complete and then we said what if we could provide them a series of readers and writers to save them time as well as handle the transaction and the restartability well in that we created spring batch then we said there was a book that came out i saw it on many developers desks it was a big thick book and it was called enterprise integration patterns and in what this what this book said was we have patterns that follow the flow of message from one system to the next through channels routing and transformations it became the de facto for building uh applications via these patterns and what we said spring is what if we create an implementation for that so people wouldn't have to write all this code and with that being said spring integration was born but then we took the next level so that we there is you know all most apps need to be able to hit a data source of some kind and a data source is where all these types from graph to key value to relational and it goes on and on and we say what if we can help people the developers integrate with these so we created spring data and spring data's mission is to provide a familiar and consistent spring-based programming model for data access while retaining the special traits and underlying data store so think about it this way i could write a jdbc app that uses jdbc but then again then again i can go and write one from neo4j but since i know how to write using spring the ability to transition that knowledge and that uh how i wrote this app in jdbc kind of go will fit and reduce that learning curve that we go for neo4j spring data is a very valuable project but then as time went on of course applications became more complex and as they became more complex we started realizing that it became more tedious to be able to integrate all these technologies together we also realized the ability to know what should what are good defaults how do we want to configure these apps so that they can work together without colliding together in a simple way to allow developers to get started all day working on the business problem at hand instead of worrying for about this dependency configuration meijer right so we created spring boot and spring boot makes it easy to create a stand-alone production grade spring based application that just runs if you think about it what spring boot does is it gives you an opinionated starter configuration or sorry provides opinion starter dependency to simplify your build configuration thus instead of me having to say okay i need to grab this create this create this and create this uh to just to build a let's say a kafka template what if i could just add a dependency to my code that would pre-configure and add that automatically and spring boot does that one of the other things that it does is you some people say well does it get in the way of actually me writing the code no spring boot quickly gets out of the way as your requirements diverge from the defaults but and i was about to say and it works right out of the box so if we think about it this way remember this where we'd have to go in have a web xml we'd have to clear the beam that we want to have and manage that and then we would have to go in and create our controller that's fine this is really really small what if i could do all that just right here spring boot takes and does away with a little bit of that boilerplate coating so i can focus on this right here one question i get do i have to use spring boot can i just use the spring framework the answer is absolutely it's your choice but spring boot does save you a lot of time in the development of your applications but applications don't just live in isolation they live in an ecosystem in distributed environments whether it's on-prem in the cloud or pardon me or in a blended environment so we realize that when i'm deploying a application and we can go ahead and start using the word microservice they need certain features in our ecosystem so they can communicate with each other right and do what they're supposed to do things like configuration management service discovery circuit breakers intelligent routing things like that so we created the spring cloud suite of projects to give you those features that you need to have your application or your microservices work in a distributed environment if you want to think about it we it comes at many levels things that where i may be on azure aws or gcp and i need to take advantage of the services that these cloud offerings offer and i need to i want to use and and implement these features in a simple way and then again that using that smooth spring way style of coding um these projects spring cloud offers these projects to simplify your life as well as um what about if i need to uh want to be able to know how to route my uh api request like we talked about before our aj brought up before we have spring cloud gateway that does that don't worry we'll cover these in a little bit more detail so don't have to copy all these down um we'll we'll make life a little easier for you but then we realized uh finally on the spring cloud front is that when we deploy these out into this um streaming environment we're not talking about running a few apps in isolation we're talking maybe hundreds of streams of data where i might have four apps that i deployed in a micro surface microservice stream i might not just have one of those i could have hundreds and i need to be able to know how do i um you know what at what time do i need to repave them uh how can i repave them how do i know how can i upgrade them roll them back in a simple way and with that being said spring cloud data flow allows me to orchestrate my deployment of my uh applications or my micro services into a a distributed environment similarly if i have batch applications that need to be scheduled and again when we talk about running batch applications we're not talking like ten or twenty we're talking hundreds thousands or ten thousands i need about able to launch those schedule those be able to go to a common place to check did they where are they successful if they were not successful how can i restart them spring cloud dataflow allows me to do that and but before we leave this page here let's talk about one more thing we've just gone through this reactive revolution reactive in the past we always wrote our code imperatively well nowadays we have a choice one of the things we're looking at is making our apps more uh um to reduce the footprint of our apps in production meaning we want to remove things such as a reduced blocking or you know use our threads more effectively reactive style coding allows us to do that so notice that we we created the project reactor to simplify life when you're creating these reactive based coding notice that it's at the same level as the spring framework the spring framework hooks into the sprig actor project and thus since it's at the foundation most projects above we see take advantage of where you can choose whether you want to write them as imperative or reactive everything from data integration um security your spring boot apps and many uh projects in the spring cloud ecosystem now for a demo that will take a long time at a desk that's far far away okay how about if it doesn't take that long and if you're near atlanta georgia it's not that far away so we're going to go to start.spring.io to begin our the building of our application so i'm going to leave the powerpoint fun here i'm going to bring up my chrome and i'm going to just do a little bit so i can see my url here and i'm going to type start.spring.io and what we get with start.spring io is we see that it takes us to this web page and at c it says spring initializer this is actually a spring project and again it creates this foundation for you for building a spring boot application it's not cogeneration right it just gives you that foundation and this is if you remember when i said that uh 18 million projects were created using start to spring dio this is the site now spring initializer is also being used by many companies they pull it in and modify it because there's certain things they want their projects to have when they start off so they actually to take and build off a spring nationalizer for their own company but what a lot of companies still do to start a project is to go to start.spring.io so what does this do for us well first off it lets me select what kind of project i want to have i can do a maven project i can do a gradle project it's up to you and what you want to do again i can choose what language spring works with java kotlin groovy whichever language you want to use spring will be there today we're going to use java again i can i'm going to be building this off of spring boot and so i'm going to use the current ga release which is 233 i'm going to rename i'm going to leave all the project metadata except i want to change the name to s1 mvc uh we'll just call it demo for today i want to package it up as a jar i want to use this foundation build i want to be java 11. and now so you remember where we had before when we saw where we had i had the three files the web xml the beam declaration and the actual code i want to use and i want to just do with the boot style i just want to write the code right so i want to add a starter dependency so i click this button called add dependency and i want to create a web-based application and it shows me that i can choose spring web and it says basically build web including restful applications using spring mvc uses apache tomcat as default embedded container what that means is that if it's going when it when i start my application right out the gate it's going to have an embedded tomcat in meaning i don't have to take my jar and plug it into a tomcat it has embedded it's ready to go and start running at that very moment so i'm going to go ahead and select spring web now what spring initializer will do for me now is once i click generate it's going to create a zip file and that zip file contains my project bits and you'll notice it says demo seven and that probably means i may have created a demo or two right off of my project right out or i may have created a few demos in my past so with that let's go to my ide there we go i lost my mouse there for a second here we go so let's go to uh and import that project i just created there we go it's gonna actually be in my downloads i'm going to open demo seven and i'm gonna open it my ide my id wakes up and it is importing the project in we'll play the jeopardy thing ah was that fast okay i'm going to zoom in and show you the bits real quick so first off it created the palm.xml right so i don't have to write that spring.start.spring.io did it for me and we can see that it has the name that i gave it it's also including what that starter web so all i have to do is focus on the code i want to write but also it creates all the other dependencies i need to have a spring boot project so all that's pre-configured i can then also see that it created me a foundation uh test just all it does is start my app and it does ethan you'll provide the tests that you want to have and then lastly it provides oops there we go we can see that it gives me my main all right so i don't have to write any of that it's done for me so now what i want to do is focus on what creating my controller the thing that actually says hello world so i'm going to create a new class i'm going to call it hello world controller and it creates that class for me um so i want this to be a rest controller all i want to do is just say hello world nothing fancy right so i'm going to say rest controller and then i'm going to go to the hello world controller and i'm going to say i want to have a public string print hello i'm not going to take any parameters this is just going to be sweet and fun and i'm going to say return hello world hit return and i want to say to i want uh to go ahead and say okay this is going to be end point i want people to hit off of i want this method to be that oh i said print tell oh that's not nice how about print hello there we go that's friendlier i like that better at request request mapping and i want to hit off the hello endpoint now i i bet y'all didn't see that i am so sorry that was small well that's what i wrote so i hope i didn't cause anybody to squint their eyes too much there so with that i'm going to go to my terminal and i'm going to run this right from the command line using a special tool that spring boot gives us from building my project using start.spring.io spring-boot or i should say the uh the boot plugin there we go and we'll see that it's actually starting my app it's going to start the tomcat embedded and it's going to be able to head off of the localhost 8080. so we're going to go back to our wonderful little browser right here and we're going to say localhost 8080. hello and we see that we got zoom in glen there we go and it said hello world well let's take it to one more step let's say hello spring one whoop not swim spring one if i could type that always helps doesn't it all right and from here what i'm going to do is i'm going to just do a classic build maven w and we'll do a clean package and we can see that it's going to do the full build process it's actually going to be like and run run our tests see that's running the test it says yeah everything's successful and then i can say java jar target and we'll say demo there and again it'll start and as it's starting we'll go back to our browser and if i hit refresh yay hello spring one we've just created a basic mvc application so with that let's play from our current slide and continue on our presentation okay you can do it hey start the spring.o remember start all your projects at start.spring.io if you ever want to have a here uh hear a wonderful uh the wonderful things that could cure go listen to josh long's talk on uh starting spring project spring boot uh i guarantee you'll get a chuckle out of it if you want to learn more about spring boot you're like yeah i want to see what else i can do with it at 11 am today right after this talk there's a talk on fundamental spring boot if you say you know how you know what can make my life easier writing spring apps in my ide what are some wonderful tools i can use spring tools 4 is going to come right after it at 11 35 today this is all eastern daylight time and friday josh long is going to have a talk on a beautiful time so if you're interested in reactive a reactive primer and spring boot that is um and the testing and have a fun time listening to it and i guarantee it's at five o'clock on a friday thursday not a friday thursday um and you're saying you know at the end of the day i guarantee if you watch it you're going to have a lot of fun and learn a lot at the same time oh wow pictures okay where do we start from here oh what are these well one of the things i wanted to do before we leave today is i wanted to kind of say here are some you know kind of pattern areas that we use every day to be able to resolve problems in our code right so i said what spring projects would help you with each of these pattern areas well let's talk about our web application the one we just wrote well it was cool it says hello but we really wasn't you know it really didn't take advantage of all the things that a web application should do well first off it needs to have security right it needs to be able to access some data also i want to know how healthy my application is what are the metrics on it well spring offers these features for you first the foundation if you see the icon down below i'm going to point here with from my screen point down below you'll see that icon there learn it love it hug it it is a spring boot icon all the projects we're going to be talking about before are going to be based on spring boot but when it comes to how do i add security to my application we're going to use spring security spring security is a battle tested security framework spring security supports many industry standard uh authentication protocols like saml oauth um ldap it also uh gives you out of the box protection for things like oh for like oh wasp attacks like session fixation click jacking cross site request forgery and more so when you're looking at security in your applications look to spring security ah again what can we say spring data simplifies our access to data stores but also it gives us that ability to remember it gives you that spring style of coding so that when i'm moving from one to other it gives me that familiar feel so it kind of again reduces that learning curve while saving me a lot of time and a lot of code while working on those various data sources and lastly how's my app doing why the metrics are there well there's a project out there called micrometer and spring boot integrates using a starter to micrometer and what micrometer does for us is it captures these metrics and stores these to a time series database or to something like wavefront so that i can go in and check those um like a wavefront and see how are my application how's my application doing and it also allows me to register alerts and all these wonderful things that wavefront can do with that this data is caught using again micrometer on spring boot so if you're interested on any of these topics tomorrow at 105 spring security uh patterns talk will be there if you're kind of you know it's a little bit advanced but i thought it was a really good talk running persistent data in a multi-cloud architecture today at 135 kind of gives you a good survey on that if you're saying you know i want to know more about metrics and capturing them and what it takes to do that spring boot observability today at 305 would be a great time again all this is eastern daylight time it's a great uh talk to attend ah you're saying what is that i will call this the symbol of microservices so for those many of us have heard of microservices some of us have coded to it some of us or don't know what it is for those so we can have a common definition of what it is microservices are a modern approach to software whereby application code is delivered in small manageable pieces independent of others another way to think of it is this way i'm going to give an example let's say i have a purchase order app in this purchase order app i want to have three again three major concerns i want to capture the purchase order and store it that's one two i want to fulfill the purchase order and then three i want to be able to bill against that purchase order well in the past i would have a monolith a large application that would have all three of those concerns but let's say for example that the billing side takes a lot of effort and we were starting to see where things were dragging down because we weren't able to build our uh it was everything was slowing down because we didn't have enough processing power to be able to handle that uh billing within our application so what we do is we scale up our monolith to be able to manage um you know to be able to keep up well now what we've done is we've scaled up a large app for one section of the app that has a problem what microservices does it says what if we were to break this up into the concerns and have a app that does the capturing the purchase orders and stores it the other app goes in and fulfills and then the third app bills so if we go back to the problem i talked about before where that purchase at the purchase that but the billing app takes more reason it takes more cycles what we can do is we can scale it up independently of the others and thus allows me to be able to adjust my portions of my app without having to upscale up the whole thing it also allows my staff to folk be able to have knowledge and be able to have a business unit work on that particular section without having to have further knowledge on other things now i can have full knowledge across all of them that's fine it's up to you and how you want to work the issue one question i ask is these people say i hear microservice microservices in spring can i still write monoliths absolutely whether you're writing monoliths or modulus spring can support you in these locations well again when i'm running micro services they don't live independently they need to communicate with each other and they also need to be able to communicate with each other on a distributed uh platform um and so the thing that i want us to understand about this is that you know when i'm running a microservice application what we see is that i have 12 i need to have there's certain rules to running a microservice app and we call this the 12 factor patterns and what this is is certain rules that our microservices have to hold to be called a microservice things like external configuration they have to be stateless they have to log they have there's there's you have to have connecting to backing service or service discovery so there's services that you have to have in order for my micro service to live in this ecosystem right well the better to make it uh to make life easier well spring is there to help you yet again yay spring with that there's things that we that services it provides like a service registry so i can register my micro services or services that my micro microservices need so that we can do what service discovery i can have a config server so one of the questions you might get is okay if i'm running in well let me finish my talk i thought with config services it gives me one location that my apps can go off in order to get what their configurations so spring cloud offers this config server to do that for you but one of the questions i get from our kubernetes folks is do i need a config server if i already have config maps in my kubernetes the answer is no you don't need it use your config maps they're awesome but what you can do is in those cases is you can pick and choose what spring cloud services you need in your infrastructure again if i'm running on-prem i don't have a config server well you will take advantage of this well also through spring cloud one of the thing is things are is that my micro services don't live by themselves they're working together through messaging frameworks right and we want to know um and be able to find maybe there's a problem with some messaging between some micro services i can use spring cloud sleuth to be able to find and be able to do discovery on where my messages are going another is if my micro services are communicating to each other are they maintaining their contracts are they uh you know i my microsource may say i need to receive data in this way how can i enforce that contract between services or know that i'm compliant well spring cloud contract offers that for you lastly like aj brought up i'm receiving requests for api requests from various services from browsers iot or mobile with that i need to be able to know how to route those to the correct microservice spring cloud gateway does that for us but what it does do it allows me to do that configuration and that monitoring of these tracks in a simple and easy way so if you're looking to that spring cloud gateway is a wonderful tool to use well if you're interested in sprint cloud today at 1205 we have introducing spring cloud if you want to know the real power of spring cloud catch it on youtube because it's happening right now i'm sorry but don't worry we're gonna be releasing some of these talks on youtube so catch them but before you say i don't have to attend the talks yeah i'll just catch them on youtube stop but stay because after each talk you're going to have the opportunity to talk with the presenter via slack and they will and the presenter will have a chance to talk with you when we look and as a presenter i look forward to doing that oh another big symbol what is this okay um all right um this is um one of the things that we have is event driven applications we're going to be receiving data right from many different systems and we just don't want that data just to you know have to be picked up and ran and in a historical fashion we want to absolutely start handle that data as it come in an example let's say i am a pizza company that has been campaigning against the one big game a year and i've uh and as that game begins i want to capture social media i want to know the impressions that are occurring from my from the customers that are out there on the social media chatting about our product our pizza or our service and so i want to catch it live so i want to start up a service that's going to hook into the twitter fire hose and take in that data then i want to take that data and i want to send it to a another app that's going to filter and transform that data okay i guess i should have slide that out a little bit there and then lastly i want to store that store that data and also send alerts to our staff so that they can go in and make a quick decision to maybe say hey a lot of people are talking about eating maybe i need to put out a campaign that says 20 let's say you know if you reach out to us the next 15 minutes we'll give you a 20 coupon if you use this code right so if we look at that we can see that that uh through that um we have the opportunity to act on that data but that's a story and i can write using spring boot i can write these micro services in an easy way and use spring cloud to be able to deploy them out there but there's one other little piece here that's missing you see that little arrow there between them i don't want that data to be ever lost i want to guarantee that data gets from one from one microservice to the other with that i want to have a transport layer underneath right so i want to use something like kafka rabbit or google pub sub you name it as an underlying infrastructure so i don't lose that data between them but that means i have to know about those infrastructures i won't be able just to write my what my business logic don't worry spring crowd stream is there to help us out sprinkle stream offers a bunch of starter dependencies that are called binders and these binders allow me to do the following i can write a function that for example in the filter and transform that will have the parameter that will take in the data uh that json data fill from twitter filter it process it and all that's and all that needs to happen and then return it out as a function so as a coder all i'm going to do is write that function the binder then says at the time i will find that function and i'm going to hook it into whatever platform you want so let's say i'm using the the by the kafka binder that comes again that started from spring cloud stream and what that means is that when i deploy my app i will set the properties to say if it's a get copica i want to this is a topic i want to use here's my ensemble here's here's all this good stuff and then what that means is as a coder i focused on the business problem and the connectivity is handled at deployment time and i don't have to write any of that code well now but when i create that stream again there's just not the one stream it's hundreds of streams it's just not for social media it's for purchase orders it's for all this stuff right so how can we handle this right how can we manage and again upgrade them uh roll them back if there's a hiccup what's their state do they feel good can i go to one place so i can hook into my metrics to check all those attributes on all these streams to orchestrate these we're going to use spring cloud data flow to do that for us it's a huge time saver if you're interested in learning more about spring cloud stream mark heckler has been given a great talk today at 1205 on game of streams if you're interested in more about data flow it's going to be tomorrow at 1205 a special plug for that one i'm also co-presenting on that and remember at the very bottom look it's spring boot our hero okay let's continue on ah my place is special to my heart batch applications if you looked at my uh profile going in i work on spring cloud tasks and spring batches royal spring cloud data flow and with that we have batch applications they are tried and true they need to they they exist to do that one thing they start they work on the stuff that they need to work on and they terminate it reduces how much apps i need to need to take up resources at that time and they do what they do extremely well so there's a couple of things that a patch app can come in the form of one as we see here it could just be a spring boot app that wakes up and does its work and finishes and it's done a spring boot app but then my boot app is going to exist what in a distributed environment and so there's certain things that my batch up my boot app needs to do even though it's what we're going to call ephemeral meaning short-lived it's got to be able to report whether it succeeded or not to a common location in that case how can i have it right to that one location instead of having to go in and try to go through my platform tooling and say did that pod exist uh complete did this app task complete well we have what's called sprint cloud task spring cloud task is is another a starter that you can do that you you can use and add just that at enable task to as an annotation to your boot application and then it will record that information to a common database that you can always go to no matter where that batch app is running or that boot app is running it will always report back to that database so you have one place you can go in and check things like what time did it start what time did it end did it succeed uh if it failed why did it fail what was the exit code and spring cloud task offer also offers a lot of other features that make your life easier in running that ephemeral app into that uh into the distributed platform lastly badge oh my gosh batch saves so much time common things that i do read process write what if i could take those readers right and i have a common set of readers that all i have to use it to do is configure no coding just i can use the the builder they have and just build out the configuration for my reader and my writer so what this means is i can have a reader that i just configure and a let's say a kafka writer writes to a topic and i can take and just use create those configuration and then the primary code that i write is my process the thing that does the filtering the arrangement the transformation whatever i need it to do in that sense spring batch offers that for me i have jdbc readers jwc writers reader writers rabbidm key reader writers it goes on and on and on right so you can take a look at the spring batch project to see what reader and writers are there and available to you but more importantly it not only offers that it also gives me the ability to configure my transaction i don't have to write the transaction model it does it for me i configure it to what i want it to do and then lastly i've been running let's say i'm running a batch app for four hours an hour two it fails i don't want to go and have to go back to all the beginning and run it for the four or four hours i just want to run it for what just for that two you know i want to pick have it pick up where that two hours is uh at that two hour mark where it failed and spring cut batch i can configure um how i want the app to restart and by doing that it will pick up where it left off if you're interested more about spring batch and uh oh forgot one more point ah there's dataflow again orchestration again i'm running batch apps in a production environment right and so i'm not just running uh tens or hundreds of batch apps i'm running thousands or ten thousand apps right how do i where can i go to that one place remember with sprint cloud task and for boot apps and then running spring cloud task with beef spring batch because again your spring batch apps will be running off of spring boot okay you don't have to but it saves a lot of time they're going to record that to one database right what if i could have a tool that goes in and i can go in through a ui or a shell or even hit off a restful api and say how are my tasks doing or those these ephemeral apps or batch apps how are they doing i could go and check and see which ones succeeded and more importantly which ones failed and then i can again go into that ui tool or that shell or hit the restful api why did you fail what happened can i restart you all this good stuff all the information is there and so at that point i can restart that job as well as again since we have micrometer i can add that to my both again the stream apps we saw above but also my batch apps below so i can go to and collect metrics and see how my batch apps are behaving and while they're running and be able to catch all that data it's pretty cool stuff right well if you're interested in this again you have batching in a modern enterprise today at 205 that's by michael mannella mahmoud's going to have a great talk on what's new in spring sorry folks my uh my my sound just went out i hope you can still hear me see uh jess i apologize i'm gonna go off screen for just a second i apologize for this oh well i think we're good okay um with that being said um we have uh the ability to uh okay going back okay and also with sprint cloud dataflow i can go in and take a look at springtile dataflow and be able to learn how to orchestrate my batch applications using spring cloud dataflow ah one more point right here uh in this case i have the ability to also go in and create functions well let's think about what do we mean by functions with functions i have the ability to say what if i could write one function that could be let's say the one that can handle the twitter data do the processing the filtering and all that stuff what if i could use that one that i wrote for spring cloud stream but also use it as a restful endpoint meaning somebody could send me that twitter that you know that json and i do that re-enrichment i do that work on it and once i do that work on it be able to hand that result back out but write the code but only once with that i have the ability to go in and sorry i'm getting announcements back there sorry with that since i can only write it once i can reuse it in multiple locations spring cloud function allows me to do that and so with spring cloud function i can go in write it once and use it in many locations it does things also for me again kind of reiterating what i said before i can write my functions imperatively or reactively the other thing is is that i may be receiving this data to this function and it might come in slightly different formats i the through spring cloud function i have the ability to go in and do uh um it handles that type conversion for me so spring cloud function does a lot of work for me so if you're interested in spring cloud function there's a couple more things that you can take a look at one is uh you there's the the today at 205 oleg's going to be giving a talk on how to implement once and execute everywhere highly recommend that talk if you're interested in again writing your code once and use it a lot of other places right the other is how can i connect my functions to r socket so if you are using r socket reactive and you're looking at mixing it with functions there's a talk tomorrow at 10 05 am on that topic now you're going to say glenn well the images the conversation you did that on your own i'm like no i got it here on spring.io you will be able to go here and it's a great launching point to learn more about what is why what is spring it allows you to get going to end those individual projects to see how they can help me and then not only how can they help me but also to um be able to go in and see why i would want to use spring in some of these other areas it also gives you uh some guides that you can use to kick off and start new stuff and if you look in the upper right hand corner i can use a light theme or dark thing so that way you can choose which one you like right that's probably the most important question i ask when i go to a site too i can't choose a light theme or a dark theme okay all right back to what one more slide folks okay so let's stay connected so now what i've done so far as i kind of gave you a tour of uh france of all the various things uh projects and like some areas that you can look at to um decide how you want your app to uh or sorry again another conversation popped up um the other thing is you also have the ability to go in and focus glenn don't look at the conversations there okay so while we covered projects and the use cases for those what we i wanted to do is spend just about two more seconds and say let's look at the deep at some of the talks i'm gonna go to uh one is a deep dive into spring application events so if you're kind of already into spring you can jump in and take a look at a deep dive into spring application events uh the other is that you can jump in and learn how to write better javadocs through if hemingway wrote javadocs with that bob i think my presentation is uh over uh hello hey all right well thank you so much for that glenn renfro we really appreciate all of that beginner spring starting us off right it's gonna be a great day here and uh there will be a q a open on the slack channel this will be uh the first time we're all trying that so uh bear with us as there might be some uh some learning ahead but uh go over to this the spring one slack channel and search for uh glenn renfrow and beginner spring um and you you will be able to give uh have a little q a with glenn's if you have any more questions what is spring again it's the name of the title track and we'll be back in a few moments with uh wylie from liberty mutual talking about fundamental spring boot keeping it simple keep it right be productive and have fun and my daughter wants me to know that her my son is not eating her breakfast and that's the way it is this morning have a great day here at spring one [Music]
Info
Channel: SpringDeveloper
Views: 6,033
Rating: 4.9595962 out of 5
Keywords: Core Framework
Id: W6KTXsG7ToI
Channel Id: undefined
Length: 56min 23sec (3383 seconds)
Published: Fri Sep 25 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.