Skip to main content


Showing posts with the label Spring Boot

Factory method 'filterChain' threw exception with message: This object has already been built

  Problem org.springframework.beans.factory.UnsatisfiedDependencyException : Error creating bean with name '': Unsatisfied dependency expressed through method 'setFilterChains' parameter 0: Error creating bean with name 'filterChain' defined in class path resource [com/.class]: Failed to instantiate []: Factory method 'filterChain' threw exception with message: This object has already been built at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.resolveMethodArguments( ) ~[spring-beans-6.0.4.jar:6.0.4] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject( ) ~[spring-beans-6.0.4.jar:6.0.4] at org.spri

Spring Boot Maven plugin - How to deploy WAR to an external tomcat's webapp folder?

 Introduction Spring Boot Maven plugin by default generates the WAR file inside the target folder. In this post, I will explain how to copy the generated war file to an external Tomcat's webapps folder using Spring Boot Maven plugin. In my earliest post , you can learn how to package a Spring Boot application as WAR.  Solution Step 1  Follow this link to specify the packaging as WAR in pom.xml and also to configure the  SpringBootServletInitializer class Step 2 (optional) Specify a cleaner name for WAR using the finalName tag in pom.xml  <finalName>auth</finalName> Step 3 Specify the outputDirectory directory      <build> <finalname>auth</finalname> <plugins> <plugin>           <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> <configuration>           <outputdirectory>D:/Development Utils/apache-tomcat-9.0.30/webapps</outputdirectory>

Spring RestTemplate - How to skip SSL certificates validation?

In this tutorial, we will explore to consume restful web services hosted on https URL with SSL certificates. We will use Sprint RestTemplate to consume the restful web services. It is very easy to consume the web services hosted on HTTP protocol. Challange is consuming the web services hosted on HTTPS with SSL certificates enabled. I encountered the following exception when accessing SSL hosted web services Caused by: PKIX path building failed: unable to find valid certification path to requested target  at at We will use  SSLContext to skip SSL validation. What is SSL Context? SSL Context is a collection of ciphers, trusted certificates, TLS extensions and options, and protocol versions. It acts as a factory

Spring Boot - How to deploy WAR file to Tomcat or any other external container?

Introduction When we develop Spring Boot application using Maven, the project is by default configured to package the project as JAR with an embedded Tomcat or another container. If we wish to export the project as WAR for deployment on the external container, we will have to change the configuration. Below are the steps to export Spring Boot project as WAR STEP 1 Change the maven.xml, replace the packaging value as provided below <packaging> war </packaging> STEP 2 Extend your main application class file from  SpringBootServletInitializer and override its  configure method as shown below Please leave your feedback in the comments box.