package com.vote.system.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.sql.DataSource;
import org.springframework.boot.jdbc.DataSourceBuilder;

@Configuration
public class DataSourceConfig {

    @Bean
    public DataSource dataSource() {
        return DataSourceBuilder.create()
                .url("jdbc:mysql://123.57.87.118:3306/vote_system?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=true&serverTimezone=GMT%2B8&connectTimeout=60000&socketTimeout=60000")
                .username("root")
                .password("GnWd2ee7M%jgpNG")
                .driverClassName("com.mysql.cj.jdbc.Driver")
                .build();
    }
}
