Initial commit
This commit is contained in:
commit
562ea28d25
122
pom.xml
Normal file
122
pom.xml
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.gis3c</groupId>
|
||||||
|
<artifactId>gis3c</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>1.6</source>
|
||||||
|
<target>1.6</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>gis3c</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<spring.version>4.2.4.RELEASE</spring.version>
|
||||||
|
<mybatis.version>3.3.1</mybatis.version>
|
||||||
|
<slf4j.version>1.7.18</slf4j.version>
|
||||||
|
<log4j.version>1.2.16</log4j.version>
|
||||||
|
<shiro.version>1.2.4</shiro.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-core</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-oxm</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-tx</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-jdbc</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-aop</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-aop</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-test</artifactId>
|
||||||
|
<version>${spring.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis</groupId>
|
||||||
|
<artifactId>mybatis</artifactId>
|
||||||
|
<version>${mybatis.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis</groupId>
|
||||||
|
<artifactId>mybatis-spring</artifactId>
|
||||||
|
<version>1.2.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<version>9.4.1212.jre7</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.oracle</groupId>
|
||||||
|
<artifactId>ojdbc14</artifactId>
|
||||||
|
<version>10.2.0.4.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<version>2.7.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.7.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-annotations</artifactId>
|
||||||
|
<version>2.7.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-dbcp</groupId>
|
||||||
|
<artifactId>commons-dbcp</artifactId>
|
||||||
|
<version>1.4</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
19
src/main/java/com/gis3c/App.java
Normal file
19
src/main/java/com/gis3c/App.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package com.gis3c;
|
||||||
|
|
||||||
|
import com.gis3c.service.HelloService;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
|
public class App {
|
||||||
|
public static ApplicationContext ContextInit(){
|
||||||
|
return new ClassPathXmlApplicationContext("classpath:spring-config.xml");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
ApplicationContext context =ContextInit();
|
||||||
|
|
||||||
|
HelloService obj = (HelloService) context.getBean("helloService");
|
||||||
|
|
||||||
|
System.out.println(obj.SayHello());
|
||||||
|
}
|
||||||
|
}
|
||||||
15
src/main/java/com/gis3c/Main.java
Normal file
15
src/main/java/com/gis3c/Main.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package com.gis3c;
|
||||||
|
|
||||||
|
import com.gis3c.service.HelloService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by hukekuan on 2016/12/28.
|
||||||
|
*/
|
||||||
|
public class Main {
|
||||||
|
@Autowired private HelloService helloService;
|
||||||
|
|
||||||
|
public void Test(){
|
||||||
|
System.out.println(helloService.SayHello());
|
||||||
|
}
|
||||||
|
}
|
||||||
8
src/main/java/com/gis3c/dao/HelloDao.java
Normal file
8
src/main/java/com/gis3c/dao/HelloDao.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package com.gis3c.dao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by hukekuan on 2016/12/28.
|
||||||
|
*/
|
||||||
|
public interface HelloDao {
|
||||||
|
public String SayHello();
|
||||||
|
}
|
||||||
28
src/main/java/com/gis3c/dao/impl/HelloDaoImpl.java
Normal file
28
src/main/java/com/gis3c/dao/impl/HelloDaoImpl.java
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package com.gis3c.dao.impl;
|
||||||
|
|
||||||
|
import com.gis3c.dao.HelloDao;
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.mybatis.spring.support.SqlSessionDaoSupport;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by hukekuan on 2016/12/28.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class HelloDaoImpl extends SqlSessionDaoSupport implements HelloDao {
|
||||||
|
@Resource(name="sqlSessionFactory_GIS") private SqlSessionFactory sqlSessionFactory;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String SayHello(){
|
||||||
|
return "hello wold";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void injectSessionFactory(){
|
||||||
|
super.setSqlSessionFactory(sqlSessionFactory);
|
||||||
|
}
|
||||||
|
}
|
||||||
8
src/main/java/com/gis3c/demo/Hello.java
Normal file
8
src/main/java/com/gis3c/demo/Hello.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package com.gis3c.demo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Administrator on 2016/12/27.
|
||||||
|
*/
|
||||||
|
public interface Hello {
|
||||||
|
public String SayHello();
|
||||||
|
}
|
||||||
26
src/main/java/com/gis3c/demo/impl/HelloImpl.java
Normal file
26
src/main/java/com/gis3c/demo/impl/HelloImpl.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package com.gis3c.demo.impl;
|
||||||
|
import com.gis3c.demo.Hello;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component("hello")
|
||||||
|
public class HelloImpl implements Hello{
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String SayHello(){
|
||||||
|
return getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public void setName(
|
||||||
|
// @Value(value = "#{configProperties['gis.name']}")
|
||||||
|
@Value(value = "HUKEKUAN") String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
8
src/main/java/com/gis3c/service/HelloService.java
Normal file
8
src/main/java/com/gis3c/service/HelloService.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package com.gis3c.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by hukekuan on 2016/12/28.
|
||||||
|
*/
|
||||||
|
public interface HelloService {
|
||||||
|
public String SayHello();
|
||||||
|
}
|
||||||
21
src/main/java/com/gis3c/service/impl/HelloServiceImpl.java
Normal file
21
src/main/java/com/gis3c/service/impl/HelloServiceImpl.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package com.gis3c.service.impl;
|
||||||
|
|
||||||
|
import com.gis3c.dao.HelloDao;
|
||||||
|
import com.gis3c.demo.Hello;
|
||||||
|
import com.gis3c.service.HelloService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by hukekuan on 2016/12/28.
|
||||||
|
*/
|
||||||
|
@Service("helloService")
|
||||||
|
public class HelloServiceImpl implements HelloService {
|
||||||
|
@Resource private HelloDao helloDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String SayHello(){
|
||||||
|
return helloDao.SayHello();
|
||||||
|
}
|
||||||
|
}
|
||||||
4
src/main/resources/resources.properties
Normal file
4
src/main/resources/resources.properties
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
gis.driverClassName=oracle.jdbc.driver.OracleDriver
|
||||||
|
gis.url=jdbc:oracle:thin:@172.16.6.13:1521:orcl
|
||||||
|
gis.username=spatial
|
||||||
|
gis.password=spatial
|
||||||
43
src/main/resources/spring-config.xml
Normal file
43
src/main/resources/spring-config.xml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns:jee="http://www.springframework.org/schema/jee"
|
||||||
|
xmlns:tx="http://www.springframework.org/schema/tx"
|
||||||
|
xmlns:context="http://www.springframework.org/schema/context"
|
||||||
|
xmlns:aop="http://www.springframework.org/schema/aop"
|
||||||
|
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||||
|
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
|
http://www.springframework.org/schema/tx
|
||||||
|
http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
|
http://www.springframework.org/schema/jee
|
||||||
|
http://www.springframework.org/schema/jee/spring-jee.xsd
|
||||||
|
http://www.springframework.org/schema/context
|
||||||
|
http://www.springframework.org/schema/context/spring-context.xsd
|
||||||
|
http://www.springframework.org/schema/aop
|
||||||
|
http://www.springframework.org/schema/aop/spring-aop.xsd" default-lazy-init="true">
|
||||||
|
<bean id="configProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
|
||||||
|
<property name="fileEncoding" value="UTF-8" />
|
||||||
|
<property name="locations">
|
||||||
|
<list>
|
||||||
|
<value>classpath:resources.properties</value>
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
|
||||||
|
<property name="properties" ref="configProperties" />
|
||||||
|
</bean>
|
||||||
|
<context:component-scan base-package="com.gis3c.*"/>
|
||||||
|
|
||||||
|
<bean id="dataSource_GIS" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
|
||||||
|
<property name="driverClassName" value="${gis.driverClassName}"/>
|
||||||
|
<property name="url" value="${gis.url}"/>
|
||||||
|
<property name="username" value="${gis.username}"/>
|
||||||
|
<property name="password" value="${gis.password}"/>
|
||||||
|
<property name="accessToUnderlyingConnectionAllowed" value="true"/>
|
||||||
|
</bean>
|
||||||
|
<bean id="sqlSessionFactory_GIS" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||||
|
<property name="dataSource" ref="dataSource_GIS"/>
|
||||||
|
<property name="configLocation" value="classpath:sql-map-config-mybatis.xml"/>
|
||||||
|
<property name="mapperLocations" value="classpath*:com/gis3c/sqlmaps/*.xml"/>
|
||||||
|
</bean>
|
||||||
|
</beans>
|
||||||
15
src/main/resources/sql-map-config-mybatis.xml
Normal file
15
src/main/resources/sql-map-config-mybatis.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||||
|
<configuration>
|
||||||
|
<settings>
|
||||||
|
<setting name="cacheEnabled" value="false"/>
|
||||||
|
</settings>
|
||||||
|
<!--
|
||||||
|
<typeAliases>
|
||||||
|
<typeAlias type="com.vividsolutions.jts.geom.Geometry" alias="Geometry" />
|
||||||
|
</typeAliases>
|
||||||
|
<typeHandlers>
|
||||||
|
<typeHandler handler="com.gis3c.common.OracleSpatialHandler" javaType="Geometry" />
|
||||||
|
</typeHandlers>-->
|
||||||
|
</configuration>
|
||||||
38
src/test/java/com/gis3c/AppTest.java
Normal file
38
src/test/java/com/gis3c/AppTest.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package com.gis3c;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for simple App.
|
||||||
|
*/
|
||||||
|
public class AppTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the test case
|
||||||
|
*
|
||||||
|
* @param testName name of the test case
|
||||||
|
*/
|
||||||
|
public AppTest( String testName )
|
||||||
|
{
|
||||||
|
super( testName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the suite of tests being tested
|
||||||
|
*/
|
||||||
|
public static Test suite()
|
||||||
|
{
|
||||||
|
return new TestSuite( AppTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rigourous Test :-)
|
||||||
|
*/
|
||||||
|
public void testApp()
|
||||||
|
{
|
||||||
|
assertTrue( true );
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user