28 lines
861 B
Java
28 lines
861 B
Java
package hycom.dao;
|
|
|
|
import org.springframework.context.ApplicationContext;
|
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
|
/**
|
|
* Klasa obsługująca połączenie z bazą danych Mapper'a.
|
|
*/
|
|
|
|
@Component
|
|
public class BaseMapperDao {
|
|
|
|
protected ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath*:context.xml");
|
|
protected DriverManagerDataSource driverManagerDataSource = (DriverManagerDataSource) applicationContext.getBean("mapperDataSource");
|
|
protected JdbcTemplate jdbcTemplate;
|
|
|
|
@PostConstruct
|
|
public void init() {
|
|
jdbcTemplate = new JdbcTemplate(driverManagerDataSource);
|
|
}
|
|
|
|
}
|