package com.sourcefellows.dependency;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class ShipService2 {
    private DataSource dataSource;
    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
    }
    public void storeShip(Ship ship) {
        try {
            Connection connection = dataSource.getConnection();
            //...
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
