Explorar o código

第一次提交

jacky6024 %!s(int64=8) %!d(string=hai) anos
pai
achega
62e3c81b34

+ 31 - 0
urule-springboot/.classpath

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
+		<attributes>
+			<attribute name="optional" value="true"/>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
+		<attributes>
+			<attribute name="maven.pomderived" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

+ 23 - 0
urule-springboot/.project

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>urule-springboot</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>

+ 6 - 0
urule-springboot/.settings/org.eclipse.core.resources.prefs

@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
+encoding/<project>=UTF-8

+ 5 - 0
urule-springboot/.settings/org.eclipse.jdt.core.prefs

@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.7

+ 4 - 0
urule-springboot/.settings/org.eclipse.m2e.core.prefs

@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1

+ 104 - 0
urule-springboot/pom.xml

@@ -0,0 +1,104 @@
+<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.bstek.urule</groupId>
+	<artifactId>urule-springboot</artifactId>
+	<version>0.0.1</version>
+	<properties>
+		<java.version>1.7</java.version>
+		<tomcat.version>8.5.5</tomcat.version>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	</properties>
+	<licenses>
+		<license>
+			<name>The Apache License, Version 2.0</name>
+			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
+		</license>
+	</licenses>
+	<developers>
+		<developer>
+			<name>Gaojie</name>
+			<email>jacky.gao@bstek.com</email>
+			<organization>Bstek</organization>
+			<organizationUrl>http://www.bstek.com</organizationUrl>
+		</developer>
+	</developers>
+	<scm>
+		<connection>https://github.com/youseries/urule.git</connection>
+		<developerConnection>https://github.com/youseries/urule.git</developerConnection>
+		<url>https://github.com/youseries/urule</url>
+	</scm>
+	<organization>
+		<name>Bstek</name>
+		<url>http://www.bstek.com</url>
+	</organization>  	
+	<parent>
+		<groupId>org.springframework.boot</groupId>
+		<artifactId>spring-boot-starter-parent</artifactId>
+		<version>1.4.1.RELEASE</version>
+	</parent>
+	<dependencies>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-web</artifactId>
+			<exclusions>
+				<exclusion>
+					<groupId>org.springframework.boot</groupId>
+					<artifactId>spring-boot-starter-tomcat</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>org.springframework.boot</groupId>
+					<artifactId>spring-boot-starter-logging</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.tomcat.embed</groupId>
+			<artifactId>tomcat-embed-jasper</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.bstek.urule</groupId>
+			<artifactId>urule-console</artifactId>
+			<version>2.0.1-SNAPSHOT</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.derby</groupId>
+                    <artifactId>derby</artifactId>
+                </exclusion>
+            </exclusions>
+		</dependency>
+
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>servlet-api</artifactId>
+			<version>2.5</version>
+			<scope>provided</scope>
+		</dependency>
+	</dependencies>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+			</plugin>
+		</plugins>
+	</build>
+
+	<distributionManagement>
+		<snapshotRepository>
+			<id>ossrh</id>
+			<url>https://oss.sonatype.org/content/repositories/snapshots</url>
+		</snapshotRepository>
+		<repository>
+			<id>ossrh</id>
+			<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
+		</repository>
+	</distributionManagement>
+
+	<name>Urule Springboot Project</name>
+	<url>https://github.com/youseries/urule/tree/master/urule-springboot</url>
+	<issueManagement>
+		<url>https://github.com/youseries/urule/issues</url>
+	</issueManagement>
+	<description>Urule Springboot Project</description>  
+</project>

+ 30 - 0
urule-springboot/src/main/java/com/bstek/urule/springboot/Application.java

@@ -0,0 +1,30 @@
+package com.bstek.urule.springboot;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
+import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.ImportResource;
+
+/**
+ * @author Jacky.gao
+ * @since 2016年10月12日
+ */
+@Configuration
+@ComponentScan
+@EnableAutoConfiguration
+@ImportResource({"classpath:urule-console-context.xml"})
+public class Application {
+	public static void main(String[] args) {
+		SpringApplication.run(Application.class,args);
+	}
+	
+	@Bean
+	public EmbeddedServletContainerFactory servletContainer() {
+	    TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
+	    return tomcat;
+	}
+}

+ 21 - 0
urule-springboot/src/main/java/com/bstek/urule/springboot/IndexServlet.java

@@ -0,0 +1,21 @@
+package com.bstek.urule.springboot;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * @author Jacky.gao
+ * @since 2016年10月12日
+ */
+public class IndexServlet extends HttpServlet {
+	private static final long serialVersionUID = 9155627652423910928L;
+
+	@Override
+	protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+		resp.sendRedirect(req.getContextPath()+"/urule/frame");
+	}
+}

+ 22 - 0
urule-springboot/src/main/java/com/bstek/urule/springboot/PropertiesConfiguration.java

@@ -0,0 +1,22 @@
+package com.bstek.urule.springboot;
+
+import java.util.Properties;
+
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.stereotype.Component;
+
+import com.bstek.urule.URulePropertyPlaceholderConfigurer;
+
+/**
+ * @author Jacky.gao
+ * @since 2016年10月12日
+ */
+//@Component
+public class PropertiesConfiguration extends URulePropertyPlaceholderConfigurer implements InitializingBean{
+	@Override
+	public void afterPropertiesSet() throws Exception {
+		Properties props=new Properties();
+		props.setProperty("urule.repository.xml", "classpath:mysql.xml");	
+		setProperties(props);
+	}
+}

+ 24 - 0
urule-springboot/src/main/java/com/bstek/urule/springboot/URuleServletRegistration.java

@@ -0,0 +1,24 @@
+package com.bstek.urule.springboot;
+
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+import com.bstek.urule.console.servlet.URuleServlet;
+
+/**
+ * @author Jacky.gao
+ * @since 2016年10月12日
+ */
+@Component
+public class URuleServletRegistration {
+	@Bean
+	public ServletRegistrationBean registerURuleServlet(){
+		return new ServletRegistrationBean(new URuleServlet(),"/urule/*");
+	}
+	@Bean
+	public ServletRegistrationBean registerIndexServlet(){
+		return new ServletRegistrationBean(new IndexServlet(),"/");
+	}
+	
+}

+ 1 - 0
urule-springboot/src/main/resources/application.properties

@@ -0,0 +1 @@
+urule.repository.dir=d:/repo