From 2e17016f8ee853ab4b140c9b7e4d7262bcffdab1 Mon Sep 17 00:00:00 2001 From: lzh984294471 <984294471@qq.com> Date: Wed, 15 Jun 2016 00:03:34 +0800 Subject: [PATCH] modified: build.gradle new file: src/main/java/com/thinker/annotation/Component.java renamed: src/main/java/com/test/util/Base.java -> src/main/java/com/thinker/main/util/BaseProperty.java renamed: src/test/java/com/test/util/BaseTest.java -> src/test/java/com/thinker/main/util/BaseTest.java new file: src/test/webapp/WEB-INF/web.xml new file: src/test/webapp/index.html --- build.gradle | 4 +--- .../java/com/thinker/annotation/Component.java | 8 ++++++++ .../main/util/BaseProperty.java} | 14 ++++++++++---- .../com/{test => thinker/main}/util/BaseTest.java | 5 ++--- src/test/webapp/WEB-INF/web.xml | 10 ++++++++++ src/test/webapp/index.html | 10 ++++++++++ 6 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/thinker/annotation/Component.java rename src/main/java/com/{test/util/Base.java => thinker/main/util/BaseProperty.java} (64%) rename src/test/java/com/{test => thinker/main}/util/BaseTest.java (50%) create mode 100644 src/test/webapp/WEB-INF/web.xml create mode 100644 src/test/webapp/index.html diff --git a/build.gradle b/build.gradle index 713d90e..8337216 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,9 @@ group 'mybatis' version '1.0-SNAPSHOT' - apply plugin: 'groovy' apply plugin: 'maven' apply plugin: 'java' + apply plugin: 'war' sourceCompatibility = 1.8 @@ -20,8 +20,6 @@ repositories { } dependencies { - compile 'org.codehaus.groovy:groovy-all:2.3.11' compile 'log4j:log4j:1.2.17' - compile 'MySQL:mysql-connector-java:6.0.2' testCompile group: 'junit', name: 'junit', version: '4.11' } diff --git a/src/main/java/com/thinker/annotation/Component.java b/src/main/java/com/thinker/annotation/Component.java new file mode 100644 index 0000000..9807322 --- /dev/null +++ b/src/main/java/com/thinker/annotation/Component.java @@ -0,0 +1,8 @@ +package com.thinker.annotation; + +/** + * Created by lzh on 16-6-14. + */ +public @interface Component { + +} diff --git a/src/main/java/com/test/util/Base.java b/src/main/java/com/thinker/main/util/BaseProperty.java similarity index 64% rename from src/main/java/com/test/util/Base.java rename to src/main/java/com/thinker/main/util/BaseProperty.java index 8f7413e..410b866 100644 --- a/src/main/java/com/test/util/Base.java +++ b/src/main/java/com/thinker/main/util/BaseProperty.java @@ -1,20 +1,22 @@ -package com.test.util; +package com.thinker.main.util; import org.apache.log4j.Logger; import java.io.IOException; import java.io.InputStream; import java.util.Properties; + /** * Created by lzh on 16-6-13. */ -public class Base { +public class BaseProperty { private static Properties prop; private static InputStream in; - private static Logger log = Logger.getLogger(Base.class); + private static Logger log = Logger.getLogger(BaseProperty.class); static { prop = new Properties(); - in = Base.class.getResourceAsStream("/mybatis.properties"); + log.info("加载配置文件"); + in = BaseProperty.class.getResourceAsStream(BaseProperty.class.getResource("/").getPath()+"/mybatis.properties"); try { prop.load(in); } catch (IOException e) { @@ -36,4 +38,8 @@ public class Base { return prop.getProperty("mapper").trim(); } +// public static void main(String[] args) { +// System.out.println(BaseProperty.getMapper()); +// } + } diff --git a/src/test/java/com/test/util/BaseTest.java b/src/test/java/com/thinker/main/util/BaseTest.java similarity index 50% rename from src/test/java/com/test/util/BaseTest.java rename to src/test/java/com/thinker/main/util/BaseTest.java index 610162e..8db5cf4 100644 --- a/src/test/java/com/test/util/BaseTest.java +++ b/src/test/java/com/thinker/main/util/BaseTest.java @@ -1,11 +1,10 @@ -package com.test.util; +package com.thinker.main.util; /** * Created by lzh on 16-6-13. */ public class BaseTest { public static void main(String[] args) { - System.out.println(Base.getMapping()); - System.out.println(Base.getMapper()); + System.out.println(BaseProperty.getMapper()); } } diff --git a/src/test/webapp/WEB-INF/web.xml b/src/test/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..3b54c58 --- /dev/null +++ b/src/test/webapp/WEB-INF/web.xml @@ -0,0 +1,10 @@ + + + + + \ No newline at end of file diff --git a/src/test/webapp/index.html b/src/test/webapp/index.html new file mode 100644 index 0000000..088491a --- /dev/null +++ b/src/test/webapp/index.html @@ -0,0 +1,10 @@ + + + + + Title + + +大好处把 + + \ No newline at end of file