 Hello and good morning everyone, welcome to my talk, intro to Spring Boot. I will assume that if you're here you generally don't know that much about Spring Boot. My goal is to provide a little bit of background and context so that you can understand my personal perspective as a Java developer, the way that we write applications for some time. It was interesting to actually describe what Spring Boot is and what is the value that it brings on top of what you're typically used to doing and what we're used to doing for a long time. I've been around Spring both as a committer and before that as a consultant for quite some time so I saw it happen first hand and I can provide some context and insight. So we will do a little bit of code, I will definitely show some hands-on stuff but the purpose here is more to give you an idea to understand what Spring Boot is about and what's special about it and then hopefully you will see that it's actually relatively transparent and that's the whole point of it, it's not meant to, it looks like magic but the whole point is that it should be easy to work with. So I'll talk about those things. So I mean traditionally for a Java developer the learning curve has been kind of very high or the getting started experience with writing, creating project has been very high and it's almost the kind of source of pride, you know, hey I can do this, you know. And if you can't that means that you're not a proper Java enterprise developer, right? You're one of those front-end developers or somebody who doesn't know as much as we do so we kind of take pride in this pain. Of course those were different times and you know we didn't have to write applications or as many applications and we kind of knew this was a problem but that's where we were and we watched other languages and platforms deal with this in particular Ruby on Rails, you know this kind of getting started experience, develop a Twitter application in 45 minutes during a demo and you know we look at it and we're kind of okay this is really cool but it will never work for the kinds of applications that I'm building because they're Java enterprise applications, right? They're serious apps, these are just toy applications. So you got Ruby on Rails of course but one thing is that over time as applications become more complex also productivity grows in importance together with that so the ability to actually achieve things and to achieve them fast became more important over time because what we do is more complex to begin with, you know the web has expanded tremendously the kinds of things that we do and also what happens over time is that we have new developers coming on the scene and they don't have the same background that we do going back to serve at one home when we learned and then we saw JSPs come along and you know the whole scene evolve and as new people come along they don't care about that history they see all the other stuff you know that helps them to develop pretty fast and they look to Java and a lot of the things that we say just doesn't make sense to them and so there is that perspective as well that the bar if the bar is too high for new people joining that's definitely a problem. Now it's not that there aren't any attempts to replicate that experience in Java so you can go quite far back something like Grails did it the groovy way the whole idea with Grails is that you have the Ruby on Rails experience with the groovy language that has enough features to provide DSLs and all kinds of ways to do things fast and so we had that and also there's things like the play framework that did it in Java of course since then you know version 2 they free worked it significantly in Scala and so those attempts exist now when you think about the spring framework so where was the spring framework in all of this with spring I mean from the very beginning it was created as a framework that exists around Java EE in that ecosystem to complement what you can do with Java EE to make it easier to reduce boilerplate code to introduce intuitive defaults and to provide a good experience in that sense so a question that I've encountered before is well if spring is to make Java developers life easy why do we need spring boots you know to make spring framework easy well the point is that spring boot is not about making using the spring framework easy the point is that the spring frameworks original goal is basically within an ecosystem Java EE and especially if you if you think about going back to 2003 when spring framework came around you have an application server deployment model you have a certain way that you deploy things you have you're dealing with third-party library choices those are all things that are generally outside of the scope and the realm that that spring has traditionally dealt with you know it took it from there so you've got your Tomcat server you've got your server API and then from there spring helps you to get started but you know you kind of need that experience that foundation to begin with so there's a lot of things that just weren't ever goals for the spring framework and they were outside of reach now there were attempts to build such things within the spring ecosystem as well some of you may remember the DM server thing that goes back quite a while now there was and there is still a project called spring rule that focused a lot on code generation you know and so that's the general background the general context in which things are happening here in the meantime we also see something much simpler come along on the scene and that's the rise of the full stack Java frameworks like drop wizard and others so the idea is very simple instead of you know going out and choosing everything that you need to start building web applications because that's the Java way right there's a lot of choices and a lot of libraries how about if we put together all the things that you need to call it the web application the most like meaningful choices that I can make for example and we'll provide an easy path for you to get started and we'll make sure you get to production as quickly as possible with as little as possible to do very simple idea very straightforward idea and you can assemble your own stack just make it easy to get started and interesting story is that in fact I will show you the original ticket so spring boot I don't know how many of you know this but spring boot originally started at a conference like this one spring one conference in 2012 a guy called Mike Youngstrom during one of these birds of a feather session said the things that he described here where he basically said hey you know the enterprise development landscape is growing quite rapidly and he basically went on and made a case about these full-stack frameworks and how when they have new developers joining their company you know they kind of see those other you know platforms and things and what can be done in there and and and he knows that spring has quite a bit to offer but it's just not packaged in the same way so he's basically saying couldn't you do a you know full-stack framework that's assembling a spring stack you know all the things that spring has to offer we know that's very powerful so why can't you do that and this this was created this ticket was created soon after the conference on October 17th 2012 and you can see a little bit below Phil Webb who is the project lead for spring boot he's basically describing short message rather than fix this in the spring framework we have decided to start a new project called spring boot and this is less than a year later and here is the github repository here's the blog post and then I would like to thank you great I'm excited to see how spring boot looks that's a happy user so it's a it's a great story I think you know that to think that you know sometimes people say well how much influence can a user have you know who is not sending pull requests or doing actual work tremendous amount of impact if you just look at this one ticket of course you know it can vary quite a bit on a scale from very little reports to something like this but occasionally something like this happens too so yes we can do that and that's how spring boot was created and let's see so this started at spring 1 2012 then the spring IO website was which at the time was running I think something with PHP was recreated using spring boot and that was actually a collaboration with pivotal labs and spring engineering so pivotal labs for those of you who don't know they're part of the pivotal organization they're consulting famous agile consulting firm and they've been using Ruby on Rails forever so kind of an interesting side story on its own because they used to use Java you know back in 2006 and then they started using Ruby they never look back so fast forward we're part of the same company and and you know this collaboration to launch spring IO on spring boot with pivotal labs engineering was an interesting experiment because you're taking Ruby on Rails developers who have you know their standards for what you can do with Ruby and let's see can you do that with Java and their initial experience was very very pleased I mean of course it's not an easy transition never is when you're making such a switch because there's a language underneath and all that nevertheless this you know was a good early indication of where this is going so it was very promising from the start but the levels of adoption you know from there it was just you know surprised everybody it's just astonishing clearly when you create something at the right time which really solves problems that are real problems it's like a way that just carries you and you go farther than you expected so to take for example Grails they almost right away rebuilt their internals so you could say that's probably not a coincidence they were probably looking for an opportunity to do something like that they had a bunch of issues but when they saw what they can get from spring boot they basically jumped on it immediately this is a graph of downloads for the year 2016 the numbers are very small because the idea is that you don't want to look at the overall numbers they're not so meaningful what's meaningful is the trend how the downloads are happening and you can see clearly that the trend is this is just over the span of one year and if you see over multiple years it's a tremendous amount of growth so what's the big deal well I mean for once you can create a runnable server application in a tweet and you can see that tweet and there were further suggestions to reduce one more line because you can make it rest controller and remove response body so you can be even shorter than that but basically you take this and you can run it with nothing else just with groovy and from the command line and that downloads everything it needs it's opinionated spring boot has opinions because you know the philosophy in the spring framework has always been you have full flexibility to do things we try to do a few things but we're not going to assume how you want to build apps but that leaves a lot of room for somebody or something to come along you to say well that's all good that I can do it but how about give me an easy getting started experience and then if I need flexibility I will take advantage of that but it's a difficult balance to strike but we will see why boot does it quite well philosophically there's absolutely no code generation this is a substantial difference between spring group that was a previous attempt to achieve something like this in spring boot we do not attempt to pre-generate code that you didn't have to somehow maintain which of course in a language like groovy is easy to adapt to but with Java you have to go through hoops to actually continuously maintain that generate traded code which is you know spring group uses in particular aspect J so there's no code generation but nevertheless it provides very useful things the things that actually matter and then gets out of your way so you can write the code and it also focuses on features in all phases of development so it's not just for getting started but it's also for production features so how does a tweetable app like that actually work what's what makes it tick so let's go ahead and go to start dot spring.io so this is a website where you can generate an initial project so I'm just going to say generate and that gives me a demo zip which I'm going to extract and now I'm going to open that in my ID and if I go here okay so what do I have at the moment this is what I have I have a maven palm I have an application Java class and if we look at that demo application class it has a main function so that prove promises that I can run this so I'll go ahead and run it but it exits right away prints a nice logo which is clearly very important but it also exits because there's really nothing else in the application so the reason why I'm starting so basic is because I want to make the point that when you start with spring boot it gives you certain basics but you don't have to necessarily run it as a web application you can create any application out of that so what's nice about this if we say maven package and if we take a look at the target directory you'll see that there are two jars one of them is the original jar so this is what you would normally expect you know that's the classes and the resources but then there is an actual jar that we can use and that's what you we call a runnable jar and you will see that the actual classes here are boot loader classes then we have a meta inf directory and in that there is a the demo application is the start class okay and then the actual classes what's interesting here is that all the jars are kind of bundled together with this thing so that means that what I can do is I can say Java dash jar and then target demo and there I'm running the thing and the reason why this is possible how this happened is because we have closed this one okay and in the maven palm you will see that there is a spring boot maven plugin which does all the work to kind of package things together and then gives you an executable jar which is which is a really nice thing because it's it's a thing which is hard to explain anybody who is not involved in Java you know you got this project and you got all these jar you got to assemble it the way to run it is actually not easy and then traditionally you deploy it into an application server but doing it like this basically it's all bundled together and it's simple as Java dash jar which makes the development experience incredibly pleasant because you know I don't need to depend on a web plugin for my IDE things that are always being sources of issues for me something doesn't work with maven with gradle and the web all I have to do is just basically right click this and run it just like a simple Java app and it just works I can debug it from the command line I can do Java dash jar or I can also do maven spring boot so just run it through the spring boot plugin and again that runs the application so that's cool so we're up with minimal effort here okay so we have an executable jar there are spring boot maven and gradle plugins that help us to do this we use the maven package command and then that will give us that executable jar this is the way that command line Java should be I would argue and that's a much nicer experience and makes a lot of sense it doesn't require any you know class path management or scripts it's already described in your in your build file so you shouldn't have to you know re-specify that it's also very cloud friendly means you just have a jar and you can you know push that jar to a cloud environment and that's all it needs to know okay so to do something a little bit more useful we can select a web dependency so if I go back to here I can type something like web and you can see here that is showing me a selected dependency I can type security like that so I can keep adding things and then generate but let's not do it all over again we can just go into the maven palm here and instead of the basic spring boot starter I'm just going to type here spring boot web spring boot starter web and then let's import those changes okay so what do we have this time so now if I say maven spring boot run I'm starting up again this time the application doesn't exit because we are actually running with Tomcat and we're on port 8080 so port 80 of course we don't have there anything there yet right so what we get now is is basically a web application jar it's like a war but it's executable you can right click this in the IT you can run it don't need web plugins or just Java dash jar or if you use spring boot with the run from the command line that gives you runs in exploded format the equivalent of exploded format question yeah so here I'm using spring boot 153 which is the current production release and we're going to talk about the runtime support in a moment but that's by default that's running with Tomcat yeah it's the so if I do the reactive support you will see that's not here but if I switch to boot to snapshots or the first milestone if I type reactive there's now a reactive web starter and that's the thing which runs with nitty out of the box right so okay so this is a big part of the story essentially one of the things that's happened over time is that the importance of deploying into a container in the traditional way has diminished and the appeal of actually doing this in embedded style has grown because it enables us to do things like that it means that you know we just do Java dash jar and we start and suddenly you know I have a Tomcat instance running with everything in it and it's an incredibly a better experience so that's definitely kind of a big trend instead of pushing apps into an app server you can now basically prepare an app and that app has everything in it and you can just push that up to to a cloud or to anything of that of that nature now if you want to run with a war because you're running in an application server which requires a war or is not embeddable you can certainly do that you would simply go into your maven palm and change the packaging from jar to war and that will produce a war and then you can push that into your app server so that choice is still there right so starter palms so let's continue to look at what is special here about spring boot so if we look at our maven dependencies so typically one of the things that we have to do to develop a web applications we have to go choose all the frameworks that we want to use we want something for Jason we want you know application server we want you know all kinds of dependencies that we need to assemble with spring boot you have the concept of these starter palms that essentially are kind of you know easy entry points into a whole bunch of dependencies that give you a certain kind of functionality so if we take a look at what's what we have here for dependencies so we depend primarily on spring boot starter web and spring boot starter web we also have a parent over here we have a parent palm and that parent palm brings curated versions of all the dependencies this is why in this palm you will not see any explicit dependency management you can change the versions but this is a big deal like dealing with dependencies and dealing with versions is something that is not easy because you have to you know kind of assemble the right versions and also pick your libraries but by using the spring boot starter web you're essentially saying I want to develop web applications give me the dependencies that I'd like the minimum dependencies that I would need to do something meaningful and we will give you with an opinion what those dependencies are you can deviate from them but this is what we think is a reasonable starting point and that close to be very powerful so what what you have here what this brings in you have the auto configuration those are things that spring boot provides then you have the Tomcat starter by default but it's very easy to switch from Tomcat to JD or undertow by essentially very small change in your palm so switching between different servers here is quite straightforward you get the Tomcat embedded yes question no in fact it's very much expected if if that dependency is within the realm of you know what spring boot integrates with you would typically get some version sometimes you may have a reason to deviate to go to a newer version or you know there may be things that you need to do like that but by by and large you know it's expected that if you want extra things that spring doesn't the spring boot doesn't integrate with or if you want to alter the version it's quite straightforward to go in for example if I want to change the version of Tomcat I don't even have to kind of spell out all the Tomcat dependencies I need to do something like this Tomcat version and because spring boot has auto configuration with a palm that defines dependency versions to begin with that means that I can easily deviate from that version and provide a different version that I want to use in my application without having to re-specify so it's all it's all made from the start to be opinionated but then it gets out of your way pretty quickly if you want to change something but again one of the big benefits of spring boot is that it provides a set of curated versions which we test and you get something that you know these versions work together not any not any bigger than it normally is I mean when you have that's exactly what this alleviates is it deals with these kinds of dependency management issues because you essentially are dealing with pre-selected versions when you start using your own versions of course you can sometimes run into into issues with clashes but I mean that's that's no different than doing anything in Java this just takes you further along it's not at all unique to spring boot no in fact spring boot actually solves much of this problem by by you know testing out there's also the spring IO platform so if you want like more stable versions there is a so spring boot moves relatively fast and upgrades versions but then there's also the spring IO platform which is a huge effort to take all the spring projects and all the dependencies that they provide and then to to give you versions of that spring IO platform that says here is a set of curated versions that all projects should work with and you can safely like you can import the bonds of this thing and then it will just suggest all the versions for you so these are kind of dependency management issues that if we didn't solve this in some way then you are left to go figure out you know all the details of what versions work together with each other okay so what we get is we get Tom Katz we get hibernate validator we get Jackson for JSON we get spring MVC and then the rest of it is for testing purposes so just a very minimal stack which means that I can go here into my demo application and I can say rest controller and yeah I mean obviously in a real application you wouldn't you know do this straight in in an application that's main but it's kind of cool that you can do that so let's say we're gonna take a request param name and we're gonna say hello name okay so let's run this local host test name Patrick on hello Patrick on okay so I mean that's that's cool let's take a look briefly here what we actually got for the response right so we just got plain text here because we're returning a string and by default we basically treat string as a return value as something to be rendered as is and we render it as text but if this was an object it would become JSON so you would have JSON rendering out of the box so that's kind of the getting started experience really effortless and really easy to to run that and these starter palms there's a whole variety of these starter palms that you can see here there's a listing in the documentation so typically if you're looking for functionality so I just did a web application because I wanted to get started from that that side but you can then look for other things that you might be interested you know whether it's related to data you know different kinds of integrations in the web layer different kinds of messaging solutions and there are these you know basically groupings of things that you might want to do and explore and just drop that in your palm and read about what it provides for auto configuration speaking of auto configuration so in order to make this work and a useful way to think about spring boot is if you just took the spring framework and you just wanted to create a web application what would you be doing so you would be creating some configuration you would be managing your dependencies then you would be creating some configuration so we give those things out of the box to make it easy to get started with kind of meaningful basic opinions and that auto configuration is basically assembling a few things for you so you can be up and running it is not magic so the auto configuration is actually something that you can easily see so this is for example the spring MVC configuration and you can look this is in the auto configure jar spring boot auto configure and you can see for the various different integrations there are auto configuration classes and this is Java based configuration so you can read it and you can understand what is doing what it's doing here for example in order for spring MVC configuration to kick in it declares that it's conditional on the presence of these classes we must have the servlet class on the class path which means we have the server API we must have the dispatches servlet which means that you have spring MVC on the class path then this is interesting because there there must be no web MVC configuration support so this is a class which actually provides spring MVC configuration and if it's present that means that you're defining the spring MVC configuration yourself so this is kind of you can begin to see the mechanism in spring boot that it backs off when you start to do things to declare them yourself it has that built-in mechanism to back off and just let you do it so they're very different levels to which you can take it you can take over a little bit you can take over much more or you can kind of take over all of it and then you can see that there are different kinds of things being created so for example there's a hidden HTTP method filter this is for when you're submitting a form and of course in HTML you cannot submit anything for for put or was it a servlet API that I think it's the forms that can do it in the browser form so essentially what you do is you're sending it as a post but then there's a hidden field that says this is actually a put and and and so then we wrap the request on the server side so it looks like an HTTP put so that way you can do a delete or put with an HTML form so there's a variety of things like that and you can basically look at what all the configuration is of course it's you're not going to understand all of that at first but the the point that I'm trying to make here is that it's all very transparent you know it's there you can see exactly what's being declared of course it's going to take some learning depending on what libraries being used but nevertheless it's it's easy to jump in and and figure out and you can begin to see what you can do to replace it and so on so it's not magic also there is a debug flag so if we do so let's do Java dash jar and then add the debug flag and then there's an auto configuration report and that tells you all the things that it found all the matches and then further down and you can see it says okay I was looking for the dispatches servlet auto configuration and that was conditional on a dispatches servlet being present it was found so it kind of tells you about all these matches and then underneath that there is also a listing of the things that didn't match and and you can kind of debug problems like that so it's pretty easy to see so in order to get started you know that kind of tweetable app you know you just go to start spring I owe you download it and you know two minutes later you're up and running with a full application doing server side endpoints we have first of all the what is called an executable jar which bundles all the dependencies together so you can do Java dash jar and run it you have a stack of dependencies that you can base very easily say I want the web starter form and that gives you a bunch of dependencies with curated versions and you have auto configuration that gives you the the basic configuration of those frameworks that we think you need to to to be up and running and and that's that's what you have for getting started any questions so far so so there are mechanisms for that and the in the spring framework and boot exposes that there are profiles the concept of profiles and environments are modeled in spring framework configuration so you can have a Java config file for development and then another one for production and you use an annotation at profile on that and then you can specify which environment you're running in in one of a variety of different ways so you can separate your configuration first of all and then with with boots also I mean there's a number of ways to specify which environment you're in they can be they can be stored externally as well yeah so there are different sources of that configuration you can there's an abstraction for how you pull the configuration property source abstraction it can come from property files it can come from environment variables it can come from just about anywhere essentially I mean it's by all means intended for running in production and it has features for running in production I don't know what you mean by there's no way to stop it because just a simple Java does jar yeah yeah it's still a graceful shutdown depending on the signal that you use and I believe there's you will see that there's management actuator endpoints and you can manage it through that it's by all means meant for running in production if you run into issues like that and you think spring boot is not ready for production take a step back and file a ticket or open a question somewhere because chances are you know there's an answer to what you're asking or if not it is intended to be like that in production so if something is missing it will be added it's not a kind of a toy that's the next thing that I'm gonna go into it's not something that's meant to to make it easy to start and then from there you know you figure it out it's meant to be for production use and a lot of people are running with it in production yeah so with an existing application you I mean based on the things that are listed here first of all you probably have a maven you know or a gradle file and you would have to kind of switch over at some point to use the spring boots maven you know configuration so you have to work that out which basically means that your maven file should become a lot smaller and then you just have to figure out what extra things you need that may not be brought in and then also the configuration will overlap to some degree so you have to experiment with running with the auto configuration and then see what special features are you enabling the thing is that again you can think of spring boot as you know the spring engineers kind of sitting down and creating application the way you would so they're using the same facilities that are available to you except they're prepackaging it so you would compare basically if you're doing any if you're configuring spring and we see in a specific way then you have to tweak those properties in the spring boot configuration the way they're exposed there well once you go through that process from there it's your code I mean boot doesn't generate any code this is what it gives you yeah I mean I imagine that if you add the the boot plugin that would be your starting point that will probably generate your runnable I haven't actually tried this but I don't see any reason why you know if you're listing out your dependencies explicitly it should still be able to generate them the executable jar just the same and then you can probably reduce those dependencies over time but I don't see any reason why that shouldn't work so this is running as embedded Tomcat yeah yeah so there is configuration for Tomcat so for example there is a there is a bunch of application properties so if we go to so there's a bunch of things that you can configure easily in Tomcat and I'll talk more about the properties configuration in a moment but there are ways that like the common things that you tend to customize are exposed as a starting point you know maybe you will find what you need there in addition to that I mean it's running as an embedded in embedded mode so you can actually get access to the Tomcat configuration APIs and you can do it that way too but essentially you're running as in the embedded mode so everything that's available to you in embedded mode is basically what's exposed that probably means that you can't take you know configuration files you know the way you would run with a installation outside but you could also switch to the war you know mechanism and then just push into into that but you know the appeal is when you can run it and you can easily switch back and forth so you can do one thing in development and then another in production correct yeah war would be just the traditional war layout yeah okay okay so we did that so going beyond the getting started experience is it about getting started well the the whole again remember that spring boot wasn't our invention they were full stack frameworks like drop wizard that we drew inspiration from and the whole idea there is yes it should be easy to get started but ultimately the point is to run in production and it should have operational aspects and it should be helpful at that level as well with exposing information about the running process by helping you with security and other features that are related to running in production so for example you can add the spring boot actuator so let's go back to the palm boot actuator and I don't need to do any versions because all of that is so spring boot basically the auto configuration it's maven dependencies are are specified through the parent palm so typically I just need to point to the dependency and that has all the versions so now if I run again then there are a variety of different endpoints that are exposed to me automatically so I can do oops unauthorized did I do I have yeah that's probably let me see here yeah so let's full authentication required let's add spring security as well okay so we're gonna do dependency spring boot security okay and let's do that again and what this will do is I can configure the users but it also the default username is user and I can take a password I can do this again and this time I can enter security and there is the information here so these are actually the mappings and that are configured in the in the application by default a lot of them happen to be the endpoint actuator mappings so let's see slash info so let's take one here for web jars so that's one mapping slash error so there's a variety of different so I can see all the mappings exposed as metadata I can also see let's see what else here environment okay so I can see information about the environment so these things the actuator endpoints also expose a model that allows you to create your own endpoints and you can accumulate some information and then expose it easily through this same mechanism because clearly there are things that we can expose out of the box but then there's others right so security we just saw that there is a spring boot starter for security and that brings in spring security with everything that you can do again the idea is all of those things exist spring boot is just providing a way to package it same way that you would accept you don't have to take those first steps it's just available in terms of the configuration so there is an application properties file and that's in the resources directory and in there is where you add your properties and there's a whole variety of properties this is the first line of customizing the configuration the first things you might go to is to go to the spring boot reference and then for each integration you will see different kinds of properties and things that you can configure so I can search on Jackson for example right so there's a whole bunch of Jackson related properties you will see you know it's all organized according to the various integrations that are that are built in so here is spring MVC for example and there's a ton of things that you can do you know to quickly tweak a thing or two and it goes quite far this way but as you can guess from this hierarchy there's also a mechanism and you can plug into that mechanism for configuration you can do things like type safe properties through ad configuration properties this is where you create a Java class that represents the properties that you're collecting and in the fields in that class match to the kind of the structure that you see here on the properties and because your properties class is a Java class with actual typed objects it will do the conversion so it does you know fancy things like that which are very very convenient for creating your own auto configuration and prefixed properties and of course each auto configuration has a bunch of these and after a while we kind of get used to this way of thinking and if you're doing something common and you think well that could be a configuration property then you can suggest it and you know the ones that appear here are the ones that are very commonly used so the way you would develop with spring boot is you would basically find the starter palm that you're interested in to see is there an integration for the sort of thing that I'm trying to do whether it's elastic search or you know rabid mq something like that you would check the documentation for the auto config see what it says kind of how does it describe what it provides you can see what properties are available to configure it so you begin to experiment like that to see what it provides you can always go to the project the underlying project and see what it exposes and so you kind of see what boot provides and what's available underneath you can also browse the auto configuration classes and see what it's actually being done and that's about it I mean it's not gonna go generate code for you again it's this is what it gives you out of the box so you can be up and running in for web applications it's actually very important to work with static resources like HTML and JavaScript and CSS typically these will be bundled in the executable jar so again we have an executable jar with everything in it and the slash star star you know from the very top will be mapped to one of these different directories so if I go into my project and under resources I can create a directory called static and I can begin to add here you know different static resources and those will be available to be served from the class path out of the box there's also a web jars prefix for those of you who know web jars this is basically the easy route to managing versions of JavaScript libraries there's a whole Maven repo with different jars that bundle JavaScript libraries and you can just use Maven to manage those so that's one way to do it and basically there's a convention here so you do slash web jars and then follow the convention of web jars and it will find it on the class path and get the resources from those jars but what you want to do very often is you want to run with spring boot run which gives you an exploded form and that means that you get the development experience where you can just refresh in the browser and you see the updates to your JavaScript and also another way to manage this is by using profiles so you can say in development I want to load from the file system but in production it's gonna come from the class path and the reason why this is very important is because if you're into managing your JavaScript kind of doing it the way JavaScript developers do using you know NPM and you know various kinds of tools that are available for JavaScript for minifying running with grunt and things like that then it kind of makes sense to create a whole separate project you know the traditional way of putting things on the source main web app is very limiting when you start working with JavaScript tooling because that's a whole ecosystem in its own right with dependency management generates a whole bunch of files it downloads it's the equivalent of having the entire maven repo on the source main web app you don't really want that sort of thing so one thing that you can do is you can create a project for your client side development and that's where JavaScript developers will work they can use NPM they can use grant as a build system to do minifying use various kinds of plugins and then you build that with Gradle or Maven to prepare a jar with with your JavaScript files and and all the static resources and then your main project server project depends on that jar so in production that's just available on the class path but in development with the development profile you can switch and point the static resources to a file location so it's just going you know through the file system and now if you make changes to your JavaScript files they're not coming from the class path but they're reloading as you would expect them to so this is a really nice way of kind of dealing with static resources if you're using JavaScript tools but of course if you're using something like web jars you know then probably putting everything in your source main web app is good enough yeah so let's talk about DevTools yeah right so with DevTools it's the experience where you as you make changes those changes are reloaded this is a very difficult problem in general I mean you have tools like zero turnaround that provides you know that kind of experience once your application is up and running when you make changes to your classes how do you keep developing in the browser to see the changes you make a change to a controller we've thought about and there are some options and zero turnaround has spent a lot of time doing that but it's it's a huge amount of effort to actually replicate the experience of reloading things and making sure everything that you might expect works and you know kudos to zero turnaround that they've done it but you know it's not easy to do that and you know we've tried going down that path and it's not it's very hard to guarantee that everything works so basically the idea with DevTools is very very simple if you make sure that the startup experience is very fast and you can do that by simply reloading the spring application context and instead of restarting the JVM and reloading all the classes then by and large most things will work it will simply reload in a new class loader the relevant classes so I can show you what that looks like let's stop this and let's run imported yeah okay okay we're almost done so now if we go to localhost 8080 test hold on here name equals budgetcon and I have to get this again from the startup log password okay so once we're in so let's say we make a change to the control this is a very common thing let's say hello again of course if I just reload here it doesn't work but in IntelliJ and Eclipse works differently and you can switch IntelliJ also but you have to kind of recompile the class and once that's done this is restarted here so it recompiled yep that restarted Tomcat something else is going on I work with this all the time in now all of a sudden it works believe me the demo guts something but basically the experience is that once you recompile a class it detects it and and it restarts the the the application and it's very quick and it's you know very seamless and you can also configure live reload in your browser so that connects through a web socket to the server and when there is a change on the server side you actually don't even have to to do anything it just kind of automatically tells it and the page refreshes in the browser automatically by itself so really cool if you check out to be that part of the reference in the spring boot documentation you'll see you'll see how it works yeah question meaning yeah so so why not just make that part of your build process and then as I was explaining earlier just included as a jar you know as a dependency so you basically build it on startup or during during the package yeah I mean that that should be achievable that goal it should be still a matter of running a you know a maven command and that should be up and running but maybe I'm missing the the question but you're still within maven so whatever you can do with maven you know it's it's it's if you have a build plugin that should still execute during the is during the phases of maven depending on what what command you're running and I realize I need to get out of the room so let me free the stage thanks for coming to my talk