Q:

Unsatisfied dependency expressed through constructor parameter 0 in Springboot

I am getting this error very first time while executing the below code on Springboot platform. I did search for this error and it was suggested at some places to add @Component but it's already there.
In this code, I am just selecting few records from a staging table and printing it.
The table structure is defined as a separate class as mentioned below. I am getting this error at the starting only so all this logic is not being triggered as of now.
Error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'applicationMainTblLoadRun': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'payConsumerMainTblLoad' defined in file [C:\Users\Documents\workspace-sts-3.9.1.RELEASE\pe_enrollment_kafkaV3\target\classes\com\example\consumer\PayConsumerMainTblLoad.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.example.consumer.PayConsumerMainTblLoad]: Constructor threw exception; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:797) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:227) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1358) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1204) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:893) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.1.RELEASE.jar:2.3.1.RELEASE]
    at com.example.consumer.ApplicationMainTblLoadRun.main(ApplicationMainTblLoadRun.java:22) [classes/:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_131]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_131]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_131]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_131]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.3.1.RELEASE.jar:2.3.1.RELEASE]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'payConsumerMainTblLoad' defined in file [C:\Users\Documents\workspace-sts-3.9.1.RELEASE\target\classes\com\example\consumer\PayConsumerMainTblLoad.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.example.consumer.PayConsumerMainTblLoad]: Constructor threw exception; nested exception is java.lang.NullPointerException
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1320) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1304) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1224) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:884) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    ... 25 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.example.consumer.PayConsumerMainTblLoad]: Constructor threw exception; nested exception is java.lang.NullPointerException
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:217) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1312) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    ... 37 common frames omitted
Caused by: java.lang.NullPointerException: null
    at com.example.consumer.PayConsumerMainTblLoad.<init>(PayConsumerMainTblLoad.java:29) ~[classes/:na]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_131]
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_131]
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_131]
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:204) ~[spring-beans-5.2.7.RELEASE.jar:5.2.7.RELEASE]
    ... 39 common frames omitted

My code hierarchy :
ApplicationMainTblLoadRun
 -- PayConsumerMainTblLoad
    -- PayConsumerEnrollmentDetails

ApplicationMainTblLoadRun :
package com.example.consumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ApplicationMainTblLoadRun {
    
    @Autowired
    private static PayConsumerMainTblLoad mainTblLoad;
    
    public ApplicationMainTblLoadRun(PayConsumerMainTblLoad mainTblLoad){
        
        ApplicationMainTblLoadRun.mainTblLoad = mainTblLoad;
    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        
        SpringApplication.run(ApplicationMainTblLoadRun.class, args);
        
        mainTblLoad.dbLoadMaintable();

    }

    
}

PayConsumerMainTblLoad:
package com.example.consumer;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

@Component
public class PayConsumerMainTblLoad {
    
    private static String id        ;
    private static String id_type   ;
    private static String vp_ind        ;
    private static String ah_ind        ;
    private static String eff_dt        ;
    private static String end_dt        ;
    private static String err_val       ;
    
    @Autowired
    PayOracleDBConfig dbConfig;
    
    //Set datasource for jdbcTeample
    DataSource dataSource = dbConfig.dataSource();
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    
    public void dbLoadMaintable() {
        
        //Fetch unprocessed records from staging table
        String sql = "SELECT id, id_type, vp_ind, ah_ind, eff_dt, end_dt "
                + "FROM fsg_prcb_file_stg WHERE process_flg = 'I'";
    
        
        RowMapper<PayConsumerEnrollmentDetails> rowMapper = new RowMapper<PayConsumerEnrollmentDetails>(){

            @Override
            public PayConsumerEnrollmentDetails mapRow(ResultSet result, int row ) throws SQLException {
                // TODO Auto-generated method stub
                
                id          = result.getString("id");
                id_type     = result.getString("id_type");
                vp_ind      = result.getString("vp_ind");
                ah_ind      = result.getString("ah_ind");
                eff_dt      = result.getString("eff_dt");
                end_dt      = result.getString("end_dt");
                
                return new PayConsumerEnrollmentDetails(id, id_type, vp_ind, ah_ind, eff_dt, end_dt);
            }
            
        };
        
        List<PayConsumerEnrollmentDetails> enrolDetails = jdbcTemplate.query(sql, rowMapper);
        
        for (PayConsumerEnrollmentDetails enrolDetail: enrolDetails) {
            
            System.out.println(enrolDetail);
            
        }
    
    }
    

}

PayConsumerEnrollmentDetails:
package com.example.consumer;

import org.springframework.stereotype.Component;

public class PayConsumerEnrollmentDetails {

    private String id;
    private String id_type;
    private String vp_ind;
    private String ah_ind;
    private String eff_dt;
    private String end_dt;

    public PayConsumerEnrollmentDetails(String id, String id_type, String vp_ind,
            String ah_ind, String eff_dt, String end_dt) {
        
        super();
        this.id = id;
        this.id_type = id_type;
        this.vp_ind = vp_ind;
        this.ah_ind = ah_ind;
        this.eff_dt = eff_dt;
        this.end_dt = end_dt;
    }

    public String getid() {
        return id;
    }

    public void setid(String id) {
        this.id = id;
    }

    public String getid_type() {
        return id_type;
    }

    public void setid_type(String id_type) {
        this.id_type = id_type;
    }

    public String getvp_ind() {
        return vp_ind;
    }

    public void setvp_ind(String vp_ind) {
        this.vp_ind = vp_ind;
    }

    public String getah_ind() {
        return ah_ind;
    }

    public void setah_ind(String ah_ind) {
        this.ah_ind = ah_ind;
    }

    public String geteff_dt() {
        return eff_dt;
    }

    public void seteff_dt(String eff_dt) {
        this.eff_dt = eff_dt;
    }

    public String getend_dt() {
        return end_dt;
    }

    public void setend_dt(String end_dt) {
        this.end_dt = end_dt;
    }

}

A:

Problem is here.
DataSource dataSource = dbConfig.dataSource();

dbConfig is a Spring managed instance. But dataSource is not.
So spring doesn't instantiate PayOracleDBConfig when  DataSource is instantiated.
Thus, when Spring tries to create an instance of PayConsumerMainTblLoad through Autowiring, the  value of dbConfig is still null and that's why you are getting a Null Pointer Exception.
Assuming, there exists a Bean of PayOracleDBConfig (through auto configuration or defined by you in some other class), this code below should do the work:
@Component
public class PayConsumerMainTblLoad {

  //Your static variables
  

  private final JdbcTemplate jdbcTemplate;

  @Autowired
  public PayConsumerMainTblLoad(PayOracleDBConfig dbConfig){
    DataSource dataSource = dbConfig.dataSource();
    this.jdbcTemplate = new JdbcTemplate(dataSource);
  }

  //Your method and rest of the code

}

