About this talk
In this session, Martin from the Spring engineering team discusses the latest enhancements in Spring Tools 5 and how they aim to boost developer productivity. He highlights the new structural view feature in Spring Framework 7 and Spring Boot 4, which presents a more organized project overview beyond the traditional file explorer. Martin also explains the Spring Data AOT (Ahead of Time) repositories and their ability to generate runtime code at build time, improving application performance and debugging ease. The talk further covers various IDE extensions available for developers using different environments, such as Visual Studio Code and Eclipse, while emphasizing the integration of AI capabilities to provide code explanations and assistance. Martin concludes by presenting an experimental feature allowing AI assistants to work in conjunction with Spring tooling, enhancing the development experience significantly.
Full transcript
Okay. Hey, welcome to all of you. Thanks for coming. Thanks for joining me for this for this session. Uh my name is Martin. Uh I come from Hamburg in Germany and I work on the Spring engineering team. So that's the team that is doing Spring Boot and Spring Framework and Spring Data and all those kind of nice little projects. Um and my uh my focus area is
on the tooling. So I basically try to make all of you more productive when you hack applications using Spring. That's the giant why. The why I go to work, the why I'm doing all this and what's the purpose behind that is really to make you more productive. Um I'm not here to convince you of any IDE or anything like that. Right? So I try to meet you
where you are and I try to make you more productive where you are and with a tool that you prefer and that you like that you love. Maybe you like Eclipse, maybe you like something else. We will see. Um we um we are doing these these these IDE extensions and this this this stuff since since a long time since I think the first incarnation of the what
was called Spring IDE back then was in 2004 already. Um, and since then we are trying to kind of improve this all throughout the years and really kick the tires of how to make you more productive. We release spring boot spring tools 5. Um, and the main the main goal is of course always to keep up with the latest versions of Spring Boot, Spring Frameworks. So whatever
those frameworks and those projects bring you as new features as kind of new things new thoughts deprecations and so on help you stay on top use the latest features and so on and kind of support you and support in the different IDE all those kind of features and with that I would like to focus on just a few areas I cannot really walk through everything of course
uh focus on a few few areas it's kind of a few things that we did for spring uh framework 7 and spring boot 4 just released um not so long ago in I think November um the new structure view which is kind of a new kind of giving you new insights and new overviews about your project from a structural point of view from a springy point of
view kind of moving away from the file explorer and the file structure and packages and giving you a different perspective and different navigation options to really look at your project and see what is inside and we will take a look at the spring data AOT repositories which is basically If you're familiar with Spring Data, you can kind of configure your repositories and define them as interfaces. So
you write those those methods and behind the scenes at runtime, Spring Data generates um the right queries and the right things on demand for you. So you don't really see that you don't need that. There's no code for it. And Spring Data introduced um an AOT mechanism for that. So that it basically produces code for those repositories at build time and just executes this code at build
time at runtime and then this kind of gives us interesting opportunities from the tooling perspective. So we collaborated with that team and came up with some kind of I think some nice additions and of course we will take a little little look at uh at AI stuff of course as well just a just a little bit and we will have maybe in the end something like in
a little one more thingy thing at the end um I hope I will get to that and don't s don't be surprised I will maybe rush through some of those things a little bit uh I don't want to bore you with all the litty nitty- details about this code completion over here and this quick fix over there. Um just give you some highlights. Uh and I will
try to kind of make room for questions in the end. So very happy to take questions and of course I will be here throughout the whole day. So very happy to discuss anything related to the spring tools or or beyond with you anytime. Right. Um we started with Eclipse back then. Um but I said we try to meet you where you are. So we provide the spring
tool extensions for ideides nowadays for visual studio code um for cursor and anti-gravity if you're more in these AI space for Eclipse of course we still ship the readytouse distribution and for for Eclipse thea as well um and we don't do that for IntelliJ question is why because my goal is not to convince you of a specific IDE I want to make you productive using Spring. If
you use IntelliJ, the Ultimate Edition already comes with really awesome Spring support. So, there's nothing for me left to do, nothing I need to do, which is good, right? Because you can be very productive using IntelligJ ultimate edition using Spring because they have great great tools for that and it's all done by Jet Brains. So, they do an awesome job and we collaborate basically on that as
well with them. So in the end you get throughout the whole landscape of IDE wherever you are great support for spring. Um and since I really don't like to show a lot of slides I go into live live coding and live demos using tools. It's always a bit bit risky but um let's see how that works out. So I start of course with my little demo project.
I use VS Code here but you will see all the same features and all in cursor and anti-gravity and Eclipse as well. So don't be surprised. It's just one example that I use here. Um and we start with the kind of in spring framework. There was a new API versioning support introduced in spring framework 7. Um the versioning support is basically in the old days when you
did these kind of rest applications and rest endpoints. You had to take care of the versioning yourselves. So version urls or whatever you use for that uh or request headers and so on. So there's no real built-in support and that changed in spring framework 7. Um so now there is built-in versioning support. So you can relatively easily use that. Um for example just by saying that this
endpoint here is for version 1.5. So if people use this endpoint and they want to use the API the the rest API for version 1.1 they get routed to this method. I don't talk a lot about the the mechanics behind the scenes, but the interesting thing is you get these little squiggly lines because we like squiggly lines, right? We we building tools, right? And this is basically
my my daily bread and butter, right? Squiggly lines. I really love them. Putting them everywhere, trying to put them everywhere where they make sense. In this case um we know that once you do something like this you try to use this feature you cannot just do it like I did this before like I did this here you need to configure the API versioning but the tooling figures
out that you haven't configured that for your for your um project. So it basically tells you the API versioning is not configured anywhere. So you get this at least this hint saying you need to configure that which is good. And of course with every squiggly line there comes a quick fix right at least we we we try to do that. So you can basically automatically do that.
There are two ways you can use property files. You can use web configurer implementations. Let me use the web configurer implementation. Uh and I just oh squealy line disappears. That that looks good. And if I move over to the web configuration, you see that there's this little configure API versioning added with in this case using request headers because that was the quick fix that I chose. There
different ways you can configure that with path segments and uh query params and so on and so on so on. Um so this um this kind of already kind of figures that out that it's configured in your code, right? There's no nothing you need to do extra to that. Um, in order to give you a nice nice little overview, we also give you a little code lens
over the controllers. So, whenever you implement controllers, we give you a little code lens that basically tells you there's a web config in place and that configures versioning using this mechanism just as a little little info. And as a plus, if you click on that, you directly jump to the web configuration because it can be located somewhere in your project. You don't may maybe you don't know
that from all the controllers that you have. You might maybe have many controller implementations. So you get that and when you implement your controller or one one thing I need I need to kind of show you in addition because I like you say I I like squiggly lines right. Uh you can configure all these different things like media parameters, path segments, query params and there are in
spring framework a few things you need to know when you use that. You can for example combine certain mechanisms but not with specific other mechanisms. So for example if you use these um oh not the media type let's don't do that. Let's do the the path segment thing um the tooling knows that uh you should not um combine path segment strategy with other strategies. You can do
that with other strategies. That's totally fine. So we give you the hint about you should not really do that. So it's few examples showing you that kind of we bake in this knowledge about how you should use spring, how it should work beyond just these usual what the compiler tells you, right? Because the compiler cannot really know whether you should invoke this method or or not or
whether you should do that I don't know let's say you you even do that kind of multiple times. It also tells you yeah you should not you should not call the same strategy multiple times and configure that differently. probably giant source of errors. Um, speaking of typical mistakes that people do, I'm sure if you have implemented a controller before, you probably did something like this, right? Because
you saw thought controllers and then you said kind of the the parent path segment. That's what people do, controllers. But actually, it's wrong. It does not work. It's not what you would expect. maybe. But that's why the red squiggly line, another squiggly line from myself, shows up. It says the attribute here, it's a string attribute, but it really refers to a component name. So you basically you
name the spring bean. If you put a string in here, but the tooling figures out that this looks very much like a path. So maybe you did something wrong. This is not a path. So if you want to do this kind of as u as a path you should put that into request mapping on the controller quick fix included of course right um so this is kind
of just a just a quick overview about the API versioning what what we did over there and there are many kind of other things in this area that we do and I will show you a few more one other thing that I personally find extremely extremely valuable and extremely useful which is totally new in in the latest version of the spring tools is that if you do
spring apps, we give you this new logical structure view. And this logical structure view gives you an overview about your project from a spring perspective. So it shows you for example in this case all these kind of stereotypes that you typ typically use together grouped for example you see all the request mappings in your project all the configuration classes all the controllers that you have implemented maybe
all the repositories that you have grouped together by these stereotypes and this happens out of the box right there's nothing you need to do for that how these stereotypes are mapped to your source code it's all configured inside of the tooling automatically for you. There's nothing you need to do about it. If you're not really happy with showing all the details, you can select what you want
to see. So, I don't only want to group everything for the web part. So, I see mappings and controllers and everything else shows up under others. Um, which is kind of very nice. It gives you a nice overview about that. Um, and as a plus, if you use something like Spring Modulith, new project kind of allows you to build kind of or to structure giant giant applications,
giant projects into certain modules with kind of certain restrictions, what you are allowed to access and what not. And there's support for that built in here as well. We also build support into the logical structure view for this. So as soon as you have your modulus project and you have modules defined in your project they automatically show up here. So I have rest bucks another example and
you see at the top level you see the modules actually not the stereotypes and the stereotypes show up below those modules. So all these stereotypes are grouped into those modules because the idea of modulus is group stuff in modules and focus on individual modules. Basically, if you have additional architectural thoughts in mind about an onion architecture or hexagonal architecture and things like that, those things can be
defined in your project as well and they show up in the structure view as well. So you get this overview about oh this is a port and this is the primary port this is a secondary port and you see what elements belong to which module to which port to which part of your application which I think is is really really really nice and again there's nothing really
you need to do for that underlying mechanism or the underlying idea comes from the um J molecules project it's basically a project kind of to define um and spring module is built on top of J molecules. So if you use uh spring modul you basically inherit or get J molecules um into your project as well. So we use that but again it's not a requirement for your
project. You don't need to put any dependencies on J molecules anything into your project just to get this logical structure just works out of the box. If you want to take a look inside, you can really actually see how those stereotypes are defined. So, let me just enable all of them again. Um, so if you want for example to see where are those stereotypes defined and how
are they exactly defined, you can basically open up the definition and the definition follows this JSON structure from J Molecules. How to define stereotypes basically the concept and there you see how stereotypes are defined how they are called the assignments so kind of is annotated with or implements a certain type what's the display name and in which groups should they show up in in this in this
in this grouping thing. Um so you can basically take a look here and the cool thing is you can also define your own stereotypes. So if you in your project you have your own specific types defined like it's not just the predefined spring stereotypes but you have maybe your own sort of language and your own stereotypes defined you can you can do that and it will show
up in the logical structure view as well which I think is very powerful. So let me for example open up something that is a DTO kind of this is an interface defined in in the restbox project uh and it's basically can be implemented by DTO's right implement all the DTOS and maybe would be nice to show them up in in in the tree as well. So you
can actually kind of put the annotation from J molecules on it say what's the ID and what's what's the group and if you take a look at here it shows up in the tree automatically for you right nothing you need to do it's just in the tree shows up you can see what are all the implementations of the that's great for that you need to have this
dependency to J molecules because this stereotype type comes from as you can see here J molecule stereotype. So if you modulate project kind of that's more or less included or you can just add the dependency not a big deal. Um but maybe you don't want that in certain cases you really like that in other cases you maybe don't like that and for those cases where you don't
like that you can of course also do something else. So let me do this uh revert this uh reload the tree. It's it's gone. Um but you can also as I said you can also kind of configure as as in with this JSON structure configure your own stereotypes with this JSON thing. So as soon as you put something into your let me try to find it over
here. Source main java resources. like J Molecule stereotypes. Let me rename this and I add a J molecule stereotypes to my project and the meta directory. This is being taken into account automatically as well. So no need to add J molecules dependencies or anything like that. You can just add the JSON following this the schema. And once you do that uh and you reload the tree again,
you will see that the DTO's show up again. Right? In this case, I called them super really super same thing but without you having the dependency in there. So you can define your own stereotypes, define their own mappings, how they should be identified in the project and let them show up in this in this logical structure here. Um, in the end almost everything shows up in the
structure view because everything that cannot be mapped or anything that cannot be mapped shows up under these kind of other things, this other note. Um, so you could even start to kind of navigate your project using this logical structure view because of course if you click on something you jump to that class or that file basically and you can you can deal with that and and work
on depends a little bit on what you prefer, what you like. Uh, and we of course would love to hear your feedback, right? If you try to use it that way, if do you find it useful, do you find it not useful, what are you missing and so on. So please give us feedback. But I think it's very it's a very interesting perspective on your project and
gives you this this brings this concept front and center that you have in mind when you hack on Spring applications because you not always hack on Spring applications and think about types and interfaces and classes. You mostly think about repositories uh entities, controllers, services and things like that. Right? That's what you have in mind when you hack a Spring application and that's what you deal with all
the time. That's your mental model. So we try to bring this mental model that you have for Spring applications into the IDE and basically visualize that directly. And that's what what what I've what I've tried to show you here, right? Um going one step further uh I said that uh spring data uh you can you can implement a a repository for example here you can just implement
here find by last name starts with spring uh starting with string last name and so on not with spring too much spring in here um and if you if you use the latest version of spring data that has this AOT capability we can actually run this AOT processing behind the scenes for you at buildtime or inside of the IDE. And the nice thing about the implementation of
the Spring AOT implementation is not only that it generates code for the repository. So there's nothing that needs to be generated or created on demand dynamically at runtime. So it's kind of it's a little bit faster than these on demand things that that happen at runtime usually. Um, but we can also bring you the code directly into the IDE so that you can see and take a
look inside because it's not producing bite code. It produces source code. So you can really see what is Spring Data doing behind the scenes as an implementation and generating as an implementation for this method in your repository. H and once you kind of once we executed this magic behind the scenes um you can actually use this code lens to go to the implementation and then it jumps
directly to the implementation of this repository interface and this method and you can see how this is implemented how this code is being generated at build time for this repository which I think is kind of very nice also very useful for debugging right if you want to kind of debug because I don't know if you debug a spring data repository in the as it's kind of you
debug through these kind of 20 different steps of generating proxies dynamically on demand and then maybe somehow you end up somewhere where you try to figure out what's going on there. But it's it's really kind of you're really debugging all the time on these meta meta meta levels of generating proxies and generating stuff on dynamically at runtime. And doing it this way makes it a lot easier
for you, right? It's faster at runtime and it's easier to debug because you can just basically put a breakpoint in here and step into the source code and debug. Really, really nice. And as you can see, there's also you can also see what kind of SQL statement is being generated by Spring Data for this repository method, which I find very interesting because this is also part of
the magic, right? Sometimes you that's kind of the nice thing about Spring Data. You just write the query as a method, right? Find by last name and if you follow the the U conventions, it does the right thing, right? But what is the exact SQL statement that kind of pops out of that? Not sure. Here you can see that. And since we know this now at build
time and up front, we can also show this as a code length directly above the query. So if you implement a spring data query um method here you just basically write it down you don't implement it you just write it down and define it in your repository and the AOT mechanism h goes on behind the scenes we can show you the SQL statement that fits to this
query directly as a code lens. So you write your repository. You basically do nothing else, right? You just write, you do the same as before. You write your interface, define the interface for the repository. You write the query query methods and the generated SQL basically appear above as code lens. you can go to the implementation and if you don't like that SQL statement because you think you
can do better or you want to optimize something or you want to change it a little bit, there's of course always in Spring Data the option to put a query annotation on top of the query method to say this is the statement for this query. Um, and of course there's this code to just do that for you, right? So you can just convert this what's basically being
generated at runtime for you convert this into source code. So you basically now switched over the mechanism for spring data say okay please use this query in this annotation now instead. Um, and if you take a very close look at what you can see here, it's kind of first it's kind of a text block because that's what kind of most people like for these SQL statements instead
of having one giant line. You can flip that back if you want to, but that's kind of the I think the preferred way to do things. You can see it's it's nicely broken into separate lines because it's not just randomly broken. It's kind of with the SQL language in mind being broken into different lines and it's syntax highlighted. So you can see the syntax highlighting embedded in
this query annotation string which is usually from the Java editor just random string but we know it's SQL or HQL or JPQL or whatever dialect you use. We can syntax highlight that and of course as I said I like quickly lines not just do kind of syntax highlighting we also do this kind of validation right so we parse it we validate this is it valid SQL or
valid JPQL and if not underline what is wrong in the statement which is a little bit like a language inside this text block inside of the Java editor inside of VS code which I think is kind of very very useful and very very nice. Um so some cool things about spring data spring data stuff. Uh there is one thing you need to keep in mind for that
is that this buildtime generation happens as part of the build and usually inside of the IDE we don't execute the Maven build all the time and so on. So and we don't want that. So if you change the repository, if you change stuff, um you should really kind of maybe kind of trigger these kind of a new build that the generated AOT information is being regenerated or
press these refresh AOT meta data then it gets built for you automatically. Um just as kind of to keep in mind, right? Um cool. Okay. Uh let's bring data. So we looked a little bit about API versioning and all the support that we do for that. We looked a little bit about the the logical structure view which is awesome about that as well I think. Um and
we talked a little bit about spring data AOT and you have also maybe seen this little code lens over this query that says explain this query to me because I have no clue what this query means. I don't understand a single word in SQL. Uh, so I need someone to tell me what this is all about. And there's this little code then saying, "Yeah, yeah, yeah, you
have an AI assistant." In this case, it's kind of co-piloted in VS Code. Um, use the AI assistant to to explain this to me. So, it's basically creating the right prompt to let the AI assistant explain you what the SQL statement is all about and how that all works, right? I hope it's correct. I don't know. uh since I don't understand SQL, but at least it gives
you kind of a nice explanation with this kind of predefined prompt that basically sticks out the right thing. It's just it's more or less a shortcut for you kind of selecting the thing and saying, "Oh, please explain this and putting that into the chat window, whatever." But it's kind of a nice little addition. And we do that for um for other elements as well. For example, if
you have a spell expression, something that I don't understand either, uh, how these spell expressions all work. So, if someone in your team put a spell expression into kind of a value value annotation, for example, you can do this as well. And it tells the AI assistant more or less precisely, this is a spell expression. Please explain the spell expression. And the AI assist is actually pretty
good at kind of understanding spell expressions really really awesome. Um so we we do that as well. Uh of course we do kind of other other nice things about here showing showing a little inline hint about what this chron expression is about but that's just a just a side note right little things here and there all across the the place where we know what spring expects somewhere.
So in this case it expects a chron expression. If this is not a valid chron expression, it underlines that. It tells you this is not a valid chron expression. If there is a valid chron expression, what does it actually mean? Because I cannot really these zero zero star. Oh, what was that about? Uh, basically tells you that because we know that here is a chron expression, here
is a SQL statement, here is a spell expression and so on and so on so we put all this knowledge into the IDE. Um, and with quickly go back to the web configuration to prepare something and I remove that piece again. So I think I will get back the warning. Yeah, that's nice. Um, so I told you that we want to meet you where you are, right?
So, how did we do this? And now it's kind of diving into this little sneak preview. So, don't take anything for granted now. It's kind of it's all experimental stuff. Right now, it's really really scary. Uh, so we started in 2004 with Eclipse. Eclipse was the main dominant IDE back then. Was open source, great API, you can put extensions in there, really awesome, right? It's was the
thing to be and the platform to use for idees and the IDE that people used back then. So we did Then in 2017, we uh jumped on VS Code. So we rearchitected the Spring tools to be able to be plugged into multiple IDEs, right? adopting this language server protocol architecture from VS Code and things like that. Um, and we changed the whole architecture behind the scenes and
then we were able to say, okay, VS Code that's kind of a a new thing that people like to use because it's very small, very lightweight, very fast, very language agnostic. So, we can support that. We should support that as well because people start to use that when they hack on Spring applications. So, we did that back then. Um and then there was this kind of little
co-pilot joining 2024 roundabout. So we added these kind of code lenses and supported co-pilot because we thought yeah that's sort of kind of a new environment emerging that we should support. And then 2025 with the release of Spring Tools 5 um people's probably even before that. So we maybe were already a little bit late on that. Started to use AI coding environments. So not just the little
addition to your existing environment but whole environments built for AI coding like cursor. Uh so if you use cursor there's a spring tools extension for that because we want to be where you are and we want to help you in the environment that you prefer. Right? So if you prefer cursor as a spring extension giving you exactly all the same features for your spring extension and with
that the question is kind of what is 2026 what is 2026 look like and now people like to use CI things and start to use cloud code and everybody's using cloud code or things like that cloud code is kind of my example here So we should be there as well. And that is what I would like to kind of show you as a little little sneak sneak
preview and demo. I have the same project over here, Spring Pet Clinic. Uh and I run Claude. Um and when I run Claude, I can take a look at this this plugins. And if I take a look at the installed plugins that I have, I installed the JDTLS plugin. So there's a plugin for the Eclipse Java tooling basically. Uh kind of gives you some kind of limited
capabilities there. U and there's this little Spring Boot plugin, the Spring Boot extension, the Spring Spring tools extension basically should probably change the name maybe. I don't know. Uh Spring tools extension for cloud for cloud code uh with a little MCP server inside. But uh we will take a look at that as details. So what what what can it do for you? you know claude code the
AI assistants they have these cut off dates so they have no clue about the latest and greatest usually but um when I ask claude now for what is um let's see what happens and I hope this is always kind of there's always hope involved here right using these AI assistants uh that they do the right thing um but you can see they call the plugin. So they
call the spring spring tools plugin behind the scenes there's an MCP server connected to that comes with a plugin they call that say because the MCP server for spring tools can give the II assistant information about what is all the latest and greatest about the latest versions of all the spring projects and what are the support dates for example right so how long is the spring boot
version 4 whatever supported in the oss and so on so now it your cloud code knows about all that right and can use that so if If you create a new project, plot code doesn't really need to think about, search the web, whatever. It tries to imagine what the greatest latest version might look like. It can just use the stuff. So it is a little bit like
the Spring tools extension in this case is reforming itself into something like it is now supporting the coding assistant instead of you doing the right thing. Right? In the in the in the old days, we we were supporting you, giving you squiggly lines, giving you information, giving you quick fixes, giving you hints uh to make you a lot more productive and a lot faster using the IDE
and the editor, right? And this plug-in for cloud code is kind of it's it's a little bit changing that to make cloud code more efficient on implementing working on spring applications. So I can for example also try to say um uh do you have any diagnostics about the owner controller let's see sometimes it works sometimes it doesn't but the idea behind that becomes I clear and this
is something we try to we try to experiment with, right? And this is not really we don't ship that yet. It's just a very very sneak preview. So don't don't use it. Don't don't try to install it yourself yet. Um but if you're interested in Oh, it really tries to do a lot of stuff here. Whatever. Yeah, everything is allowed. Um you can delete all files on
my machine, whatever you want. Oh, it now gives you a nice overview about the request mappings notable observations and now there's an interesting thing right so clot code thinks that the get mapping version attribute 1.1 is really does really is really related to HTTP 1.1 requests which is totally off right totally off so we need to kind of um tell claw to really use our tooling. Let's
see if we can we can we can do this. So um please take a look at the diagnostics using the spring boot LSP server. Let's see if we can kind of nudge it a little bit more to do the right thing. Um see what happens. just as a little kind of little sneak. You can see it's kind of very rough, right? It's very kind of very early,
very interesting, rough stuff, but now it kind of tries to use the Spring tools as an LSP server behind the scenes. So, it's basically running the LSP server that's also running inside of VS Code, that's also running inside of uh inside of Eclipse even. Um, and it's it's talking to this LSP server, getting the information from the LSP server back, and basically gives that the LLM as
responses. So, let's see what's going on. Oh, the API versioning not configured. Warning, it detected that. uh, oh yeah. So, now it kind of confirmed that that's something else. So, it basically figured out that it was wrong before and now it knows about Oh, yeah. This is the API versioning, right? Well, we need to kind of massage it a little bit. But that's kind of basically the
I think something very cool that comes next for us. I hope I think um and I hope you will like it too once we kind of have it in a way that it is a little bit more usable and and provides more features to something like cloud code or maybe other AI assistants. Um, and with that I go back to the slides and if you want to
know more and want to kind of get in contact and want to kind of get downloads or whatever you can contact us and I leave that open because there's only the thank you slide and with that I open it up for questions I think if that's okay. Uh we have a mic so please wait for the mic because I think the talk is recorded so we need
the mic so that everybody can hear the the questions if you have any questions anyone questions. Hey come on questions. No. Okay. Then I give the next speaker a little bit more time to set up and I hope you enjoy the rest of the conference and uh thanks for coming and I hope you enjoyed the session. Thank