Category Archives: learning spring boot

#LearningSpringBoot Video is on its way!


I just signed a contract to produce a video-based sequel to Learning Spring Boot, a veritable 2nd edition!

This will move a lot faster than its predecessor. Schedule says primary recording should be done sometime in August, so hopefully you can have it in your hands FAST! (I know Packt has quick schedules, but this is even faster).

This won’t be some rehash of the old book. Instead, we’ll cover a lot of fresh ground including:

  • Diving into Spring’s start.spring.io website.
  • Building a rich, fully functional web app using Spring Boot, Spring Data JPA, Spring Security, and more.
  • Using Boot’s latest and greatest tools like: Actuator, DevTools, and CRaSH.

I’ve written three books. Recording video will be a new adventure. If you want to stay tuned for updates, be sure to sign up for my newsletter.

Can’t wait! Hope you’re as excited as me.

Spring Boot is still a gem…waiting to be discovered

devnexusLast week, I had the good fortune of speaking twice at the DevNexus conference, the 2nd largest Java conference in North America. It was awesome! Apart from being a total geek fest with international attendance, it was a great place to get a bigger picture of the state of the Java community.

intro-to-spring-data-devnexus-2016A bunch of people turned up for my Intro to Spring Data where we coded up an employee management system from scratch inside of 45 minutes. You can see about 2/3 of the audience right here.

It was a LOT of fun. It was like pair programming on steroids when people helped me handle typos, etc. It was really fun illustrating how you don’t have to type a single query to get things off the ground.

platform-spring-bootWhat I found interesting was how a couple people paused me to ask questions about Spring Boot! I wasn’t expecting this, so it caught me off guard when asked “how big is the JAR file you’re building?” “How much code do you add to make that work?” “How much code is added to support your embedded container?”

learning-spring-bootSomething I tackled in Learning Spring Boot was showing people the shortest path to get up and running with a meaningful example. I didn’t shoot for contrived examples. What use is that? People often take code samples and use it as the basis for a real system. That’s exactly the audience I wrote for.

People want to write simple apps with simple pages leveraging simple data persistence. That is Spring Boot + Spring Data out of the running gate. Visit http://start.spring.io and get off the ground! (Incidentally, THIS is what my demo was about).

I-heart-spring-AidenI was happy to point out that the JAR file I built contained a handful of libraries along with a little “glue code” to read JAR-within-a-JAR + autoconfiguration stuff. I also clarified that the bulk of the code is actually your application + Tomcat + Hibernate. The size of Boot’s autoconfiguration is nothing compared to all that. Compare that to time and effort to write deployment scripts, maintenance scripts, and whatever else glue you hand write to deploy to an independent container. Spring Boot is a life saver in getting from concept to market.

It was fun to see at least one person in the audience jump to an answer before I could. Many in the audience were already enjoying Spring Boot, but it was fun to see someone else (who by the way came up to ask more questions afterward) discovering the gem of Spring Boot for the first time.

CedricTo see the glint in someone’s eye when they realize Java is actually cool. Well, that’s nothing short of amazing.

Debug and Maintain your Spring Boot App

It’s out! My webinar, Debug and Maintain Your Spring Boot App, is now available to watch right here. Learn how to:

  • Figure out what Spring Boot has done, so you can tweak things as needed.
  • Discover property override settings, and not be done in by out-of-date docs.
  • Merge metrics and commands as needed for DevOps support.

I hope you enjoy this meme-tastic, code-filled webinar I hosted.

If you’re interested, the code for it can be found at https://github.com/gregturn/debug-your-spring-boot-app. The basis of this code is Chapter 3 of Learning Spring Boot. If you’re interested, you can sign up today for my technical newsletter and hear up-to-date news including alerts about Learning Spring Boot.

Today is “Day against DRM”. My fine friends @PacktPub are offering a 24-hour flash sale. #AgainstDRM

I have written three books for Packt Publishing over the past five years (Learning Spring Boot being the latest). They have supported me well. Many of you are aware of DRM (Digital Rights Management). That is coder speak for “wrapping content you bought with controls left in the hands of supplies”. I don’t dig DRM. I cheered it when free market competition brought out DRM-free music from certain vendors.

I believe in paying for content to support creators, but also having the freedom to put content I purchased on any of my devices. It’s another reason I like Packt. Their e-books have been DRM-free since Day 1 (2004). That is über cool.

Whereas I would leap for joy if you bought a copy of my book, I sincerely ask that you search their vast list of titles and pick out something you enjoy.

Happy reading!2015 Banner

 

Announcing the winner of our #LearningSpringBoot contest…. /cc @PacktPub

Over the past month, we have had several entries. We have rallied together an international set of both contestants and judges. And here are the results!

The contestants

First of all, let’s list the applications that were submitted (in alphabetical order).

1. Mercury

This app is used for piping various types of traffic over different systems. It leverages Spring Boot’s conditional settings, allowing the user to customize as needed. It also has a hypermedia-based RESTful API.

2. Polaromatic

This application shows cute eye candy. It ingests files and manipulates them to look like “Polaroid” snaphots and dynamically displays them on the screen. It has a Spring Boot CLI script to fetch pictures from Flickr. It is Groovy all the way (all the way to the web templates). It uses websockets, Spring Integration, has nice Spock test cases, and

3. VotesApp

This application is a bot that listens in on chat sessions to count votes for/against spontaneous activities. That way, they can quickly get a tally of who all is going/not going on the fly. It has a pluggable architecture, comes with a video demo on an Android smartphone, uses Project Reactor, and leverages Spring’s profile support.

The results

Each of these apps was top notch. The contestants showed real skill. As judges, it was very hard because each team went in a different direction. Spring Boot offers a lot of concise and flexible power, and each of the entries used it well, just differently.

The winner **drum roll**

And the winner is…..Polaromatic! If you want to see, the winner has a running copy here. Visit it and simply wait a few seconds to see the outcome. The team behind Polaromatic has won a free copy of Learning Spring Boot.

Thanks for all who entered!

Valuable things I have learned while writing three books for @PacktPub

I recently had a friend of mine ask me about the viability of writing a book for his open source project. He had questions about how to submit a proposal as well as the money involved. I wrote him a detailed response, but decided to post some of my lessons learned here.

Don’t write a book for the money

This is definitely a worn out expression. I have seen people get this starry gleam in their eye, Sorry, but that only happens when you write a best selling, fictional trade novel. Not everyone can be J.K. Rowling. In fact, there are actually a very small number of authors who make it big. The real name of the game in writing is to write LOTS of books, such that over time, people that like your material end up buying all your titles.

When writing technical books, you still need to sell a bunch to really make any money, but we are forever cursed by books going out-of-date in just a few years. Trade novels last a lot longer.

That may sound a tad depressing. So why write book? Because it can open doors you never knew would happen. When you are a published author, it can impact interviews, speaking engagements, consulting opportunities, and other things. It is always a major +1 to your CV to have written a title. Even more if you get several under your belt. It also increases your overall name recognition and personal brand.

Understand what you’re getting into

Before expending any effort in writing, I made sure we had a contract in place that we both agreed to. I’ve read article where people keep writing chapter after and yet have not signed an agreed upon contract. I don’t work that way. You are taking on risk by doing that. Until a contract is in place, the publisher can bring onboard other writers.

I have historically preferred to write my titles by myself. It lets me control the content 100% and not have to deal with interacting with another author, one who might/might not be as motivated as me. As a nice side effect, it also ensures that I get all the money. Since we’re already talking about a small pile of money, it feels counter production to split it up amongst two or three people.

Packt’s contracts include an option of first refusal for your next two titles. I understand Packt’s desire to get first dibbs on future work. It make business sense, so I had no issue with this in my first two titles. But on the third one, I had decided they had made enough money on me. I asked that this clause be removed to liberate me for future works. I have no hard feelings nor have I felt any malice from anyone at Packt.

Be sure to understand that the contract includes deadlines and exactly how much money you’ll be paid and when. If you sign the contract, you are agreeing to everything stated. Understand what you are agreeing to.

It’s your title. Act accordingly

Every publisher out there will probably tell you how glorious their marketing and sales team is. But for you to write a book and make no mention on Twitter/FaceBook/Google+, nor to write a peep on your blog site is ridiculous. You should be blogging all the time as you write and beyond publishing. Don’t assume that your publisher will automatically sell 1000 copies of your book and be fired up to order another batch!

Another aspect of “acting accordingly” is to remember this will reflect first and foremost on YOU. If you have a certain voice or a style of presentation when you speak at conferences, then by all means, try to write that into your manuscript. Your editors may try to edit that out. If you give them the upper hand, they can reduce your effuse writing into boring humdrum. I’ve seen editors edit out some of my sassy writing. My response? I edit it back in! They don’t usually push back too hard.

It’s important that the publisher have a certain level of quality. But there needs to be enough of YOU in whatever you write that makes it stand out.

Go and read other people’s technical books. Part of this inspiration for me came from a couple other technical books I read. The style these author’s wrote knocked me out of my chair. I LOVED the small jokes, clever class names, and funny material they injected into their writing. And it told me I could do the same, as long as it wasn’t offensive or obnoxious. Again, my editors pushed back, but I paid keen attention to EVERY edit, and undid several of these. I wanted my book to be fun.

Making your book fun is no one’s job but yours.

Take credit for your work – give credit to others

In my latest title, I started each chapter with a quote from twitter. “Spring Boot” was so hot, that I started collecting tweets as I wrote. I would launch a chapter, and include a link to that user’s twitter handle. Their comments were inspirational. I hope they picked up new followers.

At the same time, I gave a presentation that pre-dated release of my book. I mocked up a logo of the book with the title in it, and included that in my profile slide at the beginning. This was a PR moment I wouldn’t pass up. I wanted everyone in that audience to know a book was coming, and hopefully they all bought a copy!

That same week, my colleagues and I trekked to a JUG meeting. Someone in the group asked, “Is there a book on Spring Boot coming?” Everyone turned to me, and I happily gave them the estimated release date. More free PR. I also was sure to cc more than a handful of tweets to that group’s twitter handle. Hopefully they each bought a copy! (Not likely, but one can dream, right?)

Finally, I wrote my last title using asciidoctor thanks to Dan Allen. This was by far the best option. It allowed me to focus on quality content and not idiotic Word Processor issues.

Knuckle down and write

Okay, all these suggestions up to this point are nice and all, but it’s all for naught unless you put in the hours to actually write your book. I read someone’s blog article where they thought the deadlines were crazy since they only planned to write on the weekends.

Sorry, but I don’t have much sympathy there. I wrote each of my books while we also had a newborn baby. I quickly adopted the style of writing every night after everyone had gone to bed. This way, I could focus with no distractions, and then take the weekend off. Writing every night from 10pm-midnight can be exhausting when you mix it with feeding a baby at 2 AM, but this ensured that I got my book finished and out the door. It also cut down on the risk of my technology moving away from me too quickly and making the material invalid, or avoiding massive rewrites due to mega-changes.

Another thing you have to be ready to do is carry your book all by yourself. You can’t depend on certain reviewers to fix things for you. Instead, you need to be ready to proof read in the event your book reviewers don’t actually give you any feedback until the last minute. It’s sad, but this still reflects on you.

There were times when I hit bugs in my sample code, and had to simply pack up for the night. There were other times when I had no choice but to work an extra two hours to hammer out a problem that no one else could help me with, either in my asciidoctor backend, or in my sample code. After all, no one was going to pick this up and fix it, right? Leaning on pull requests, etc. is no excuse for not writing your book.

I demoed Spring Social GItHub in my latest book, and had to go to press using version 1.0.0.BUILD-SNAPSHOT because the project lead was simply too backed up to fix the milestone release already published which broke my book’s sample code. Them’s the breaks.

So by now, if I haven’t smashed your dream of writing a technical book too badly, I wish you only the best in going out, submitting a proposal, and snagging a contract.

One week left for #LearningSpringBoot contest!

3021OS_mockupcover_normalIt’s not too late to join the Learning Spring Boot contest! Spring Boot has made it super simple for people to create new apps rapidly. You still have plenty of time!

I’ve seen a few tweets from contestants. Are you secretly working on an entry? Tweet your github repo, and I’ll DEFINITELY star it so you can score some extra points with the judges.

Just visit the contest site, fork it, create your app, and submit a pull request by January 17th 11:59pm CST (UTC-6).

I’ve already seen cool traffic a la twitter. I would also suggest posting links/announcements at https://www.facebook.com/springsource as well!

Good luck!

GitHub offers more ways to develop than I’ve ever seen!

computer_coffeeHave you moved your code base to github in the past year? Earlier than that? Or are you contemplating heading that way.

There are means and opportunities you can’t possibly imagine when you do this. Of course, the immediate benefit is that 100,000s (if not millions) of developers will already be familiar with this platform for sharing code. It’s a great way to look at individual files, pick out lines, create issues, process feedback, and make contributions, all starting with editing a single word in someone’s comment.

But that is just the beginning. With the rise of forking, people can take projects in new directions. Experiment, prototype, throw away ideas that led into dead ends.

On top of that, the people at github invented the concept of organizations. A lot of people start with creating projects in their own personal space. But you can create an independent organization, and use it as the means to coordinate groupings of projects and other things. And get this: a repository isn’t confined to a releasable software project.

3021OS_mockupcover_normalRecently. I published Learning Spring Boot. All the code is available online for free. Naturally I want you to buy my book so I you can learn all the detailed semantics. But for those that have the book, they can grab a nicely distributed copy of the source and not have to type all in by hand.

Then when my editor started discussing some sort of contest where people submit sample projects built with Spring Boot, I realized that github was PERFECT for such an idea. I immediately created the https://github.com/learning-spring-boot organization, put the source code for the book there, and went on to set up a separate repository dedicated to the contest.

With github’s ease of forking and submitting pull requests, I have directed all contestants to fork the contest, code their Spring Boot application entry, and submit it as a pull request. That way, the judges can visit each entry and easily evaluate it. It also provides the means for contestants to tweet their entries, encouraging others to “star” their entries.

And who knows what will come next? If the contest is a success, we can always hold another one. Or whatever else we think of down the road.

The point is, by embracing github, you open the door to an incredible set of possibilities that you can’t even imagine right now.

Cheers!