fix for database connection error

This commit is contained in:
Marcin Michałek committed 2015-01-24 22:49:28 +01:00
1 parent 84f77ba292
commit 2dc62ad286
2 files changed
+4 -11

No files matched your search

+3 -1
View File
@@ -2,6 +2,7 @@ package hello;
import hello.agh.edu.bazy.dbApi.gis.GisdbApi;
import hello.agh.edu.bazy.row.GisLamp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -15,7 +16,8 @@ import java.util.List;
@Controller
@RequestMapping(APIServicePaths.GIS_CONTROLLER)
public class GisController {
GisdbApi gisdbApi = new GisdbApi();
@Autowired
GisdbApi gisdbApi;
@RequestMapping(APIServicePaths.GET_ALL_LAMPS)
@ResponseBody
@@ -1,18 +1,11 @@
package hello.agh.edu.bazy.dbApi.gis;
import hello.Application;
import hello.agh.edu.bazy.postgresql.gis.GisDataSource;
import hello.agh.edu.bazy.row.GisLamp;
import hello.agh.edu.bazy.row.mappers.GisRowMapperForLamps;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import java.util.List;
@@ -26,9 +19,7 @@ public class GisdbApi {
private static final String PUT_LAMP = "INSERT INTO public.gis_points(gis_points_id, way, highway) VALUES (1, st_geomfromtext('POINT(? ?)',4326), 'street_lamp');";
private static final String GET_LAMP = "SELECT tags, st_transform(way,4326) FROM gis_backup.planet_osm_point WHERE osm_id=?";
public JdbcTemplate getGisJdbcTemplate() {
return gisJdbcTemplate;
}
@Autowired
JdbcTemplate gisJdbcTemplate;