asked on
package ncs.app.co.za;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
@SpringBootApplication
public class NcsApp {
@Autowired
NocIigJDBCTemplate iigJDBCTempalate;
public static void main(String[] args) {
// TODO Auto-generated method stub
SpringApplication.run(NcsApp.class, args);
}
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return args -> {
final NocIigJDBCTemplate iigJDBCTempalate = (NocIigJDBCTemplate) ctx.getBean("NocIigJDBCTemplate");
System.out.println("Listing iig records : ");
iigJDBCTempalate.displayEmpList();
};
}
}
ASKER
package com.app.co.za;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportResource;
//@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {
// "ncs.app.co.za"
//})
//@ImportResource({ "classpath*:AppConfig.xml" })
@SpringBootApplication
public class NcsApp {
@Autowired
NocIigJDBCTemplate iigJDBCTempalate;
public static void main(String[] args) {
// TODO Auto-generated method stub
SpringApplication.run(NcsApp.class, args);
}
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return args -> {
final NocIigJDBCTemplate iigJDBCTempalate = (NocIigJDBCTemplate) ctx.getBean("NocIigJDBCTemplate");
System.out.println("Listing iig records : ");
iigJDBCTempalate.displayEmpList();
};
}
}
log4j:WARN No appenders could be found for logger (org.jboss.logging).Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.
TRUSTED BY