package karthik.oauth;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class OauthServerMain extends SpringBootServletInitializer{
/**
* Main data source containing the credentials.
* In this is example this is the DB from the resource server.
*/
@Bean
@Primary
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource mainDataSource() {
return DataSourceBuilder.create().build();
}
public static void main(String[] args) {
SpringApplication.run(OauthServerMain.class, args);
}
}