Postingan

Menampilkan postingan dengan label spring boot

The @SpringBootApplication annotation Example in Java + Spring Boot

Gambar
Hello guys, today, we'll learn about the @SpringBootApplication annotation, one of the most important annotations from popular Spring Boot framework, which has changed the way Java developers use Spring framework for writing Java applications. In this article, I'll explain to you the meaning of @SpringBootApplication and it's used in a simple Spring Boot application. We use @SpringBootApplication annotation on our Application or Main class to enable a host of features e.g. Java-based Spring configuration, component scanning, and in particular for enabling Spring Boot's auto-configuration feature. If you have been using Spring Boot for a long time then you know that earlier we need to annotate our Application class or Main class with quite a lot of annotations to start with like @Configuration to enable Java-based configuration, @ComponentScan to enable component scanning, and @EnableAutoConfiguration to enable Spring Boot's auto-configuration feature, but now you c...

Top 5 Courses to Learn Spring Boot in 2020 for Java Developers - Best of Lot

Gambar
Hello guys, if you are interested in learning Spring Boot and looking for some excellent resources, e.g. books, tutorials, and online courses to start with, then you have come to the right place. Earlier I have shared some great books to learn Spring Framework, including Spring Boot (see), and today, I'll share some of the best online Spring Boot courses you can join to learn Spring Boot by yourself. In the past, I was a big fan of learning from a book, but online courses have changed that completely. Now I prefer to start with an online course, likeSpring Boot Essentials, and then move on to a book like Spring Boot in Action for more comprehensive learning. Anyway, before going through those Spring Boot courses, let's first revise what Spring Boot is, and it's benefits and why you should learn it. Spring Boot is one of the best frameworks for Java developers, and if you don't know yet, probably 2020 is the best time to learn Spring Boot. Just like Spring makes Java d...

Top 5 books to Learn Spring Boot and Spring Cloud for Java Developers - Best of Lot

Gambar
Hello guys, if you are a Java developer and want to learn Spring Boot and Spring Cloud frameworks and looking for some of the best books and courses, then you have come to the right place. In the past, I have shared some of the best Spring Boot and Spring Cloud courses, and today I am going to talk about some of the best books to learn Spring Boot and Spring Cloud, but before that let's try to understand what is Microservice and how Spring Boot and Spring Cloud helps with development of microservices in Java. In simple words, Microservices is nothing but an extension of RESTful web services with the fundamental idea to break up your code into small, distributed, and independent services for better scalability and management, but it does require thoughtful design and think through ability. Fortunately, Spring Boot and Spring Cloud simplify your microservice applications by providing standard and essential features and allowing them to focus on business logic by abstracting away the ...

Top 5 Spring Boot Features Java Developers Should Know

Gambar
You might have heard about Spring Boot and it's magical powers about creating a Spring Web application in just under 140 characters which can be written in a tweet, but what that really means? What are those features which provide Spring Boot such power and make Spring application development so easy? Well, that's what you will learn in this article, but if you are in hurry let me tell you that you will learn about Spring Boot's auto-configuration, Starter dependencies, Spring Boot CLI, Actuator and Spring Initializer feature in detail. These are the feature which takes away most of the pain and friction associated with writing Spring-based Java web application. But, before going into this detail, let's revisit the problems associated with Spring-based Java development. I personally like to see the problem first and feel it before I can enjoy the solution. Remember, comfort feels better only after hard work and so is a meal, you enjoy more when you are hungry. Spring is...

How to Consume JSON from RESTful Web Service and Convert to Java Object - Spring RestTemplate Example

Gambar
So far, I have not written much about REST and RESTful web service, barring some interview questions like REST vs. SOAP, which is thankfully very much appreciated by my readers and some general suggestions about the best books to learn REST in the past. Today I am going to write something about how to consume JSON from a RESTful Web Service in Java using Spring Framework. I will also talk about how to convert the JSON to Java objects using Jackson. You will also learn about the RESTTemplate class from the Spring MVC framework, and how you can use it to create a REST client in Java in just a few lines of code. Similar to its predecessors JdbcTemplate and JmsTemplate, the RestTemplate is another useful utility class that allows you to interact with RESTful web services from a Java application built using the Spring framework. It's a feature-rich and supports almost all REST methods like the GET, POST, HEAD, PUT or DELETE, though we'll only use the GET method in this article to co...

Difference between @ContextConfiguration and @SpringApplicationConfiguration in Spring Boot Testing?

Gambar
Even though both @ContextConfiguration and @SpringApplicationConfiguration annotations are used along with SpringJUnit4ClassRunner to specify how to load the Spring application context, there is a subtle difference between them. Although @ContextConfiguration does a great job in loading application context it doesn't take full advantage of Spring Boot features. Spring Boot applications are ultimately loaded by either SpringApplication ( in case of the JAR) or SpringBootServletInitializer. This class not only loads the application context but also enables logging and loading of external properties specified in application.properties or application.yml file, and other features of the Spring Boot framework, which is not loaded or enabled by the @ContextConfiguration annotation. In short, it's better to use the @SpringApplicatoinConfiguration annotations rather than @ContextConfiguration for writing an integration test for Spring boot application, including a test for web pages o...

Top 5 Spring Microservices Courses with Spring Boot and Spring Cloud

Gambar
Microservices is the new buzz word in software development word and everybody is talking about it, but it's been in practice for quite some time especially in the form of RESTful web services. The idea of Microservices is simple, breaking a big monolithic application that contains everything from UI to service layer to database into small chunks of applications that are loosely coupled and can work on their own. For example, in a company like Uber, you could have several applications providing different services e.g. discovering when a driver is online or a passenger is searching for a cab, finding a route, traffic and handling payments. These small applications are known as Microservices. In Java world, Spring provides several tools and frameworks to develop microservices e.g. Spring Boot and Spring Cloud and in this article, I'll share a couple of good courses you can use to learn how to develop Microservices using Spring framework. These courses not only teach you the basics...

Top 20 Spring Boot Interview Questions with Answers for Java Developers

Gambar
Hello Java developers, there is no doubt that the Spring Boot is now the standard way to develop Java application using Spring Framework, and that's why Spring Boot Questions are increasingly becoming popular on Java interviews. In the past, I have shared many Spring MVC interview questions in this blog like the @RestController vs. @Controller, but I haven't got a chance to share any questions on Spring Boot, Spring Cloud, and Microservices. After a couple of personal requests from my readers, I thought to write about, and here comes my list of top 20 Spring Boot interview questions for Java developers. In this list, you will tackle all-important Spring Boot concepts from an interview point of view like auto-configuration , starter dependencies , Spring Boot CLI , and Actuator . Once you have gone through this list, you should have sufficient knowledge to tackle any Spring Boot question on the real interviews. Arguably, Spring Boot is the most significant and exciting thing t...