Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 813a2b4

Browse filesBrowse files
authored
Merge pull request #1 from GLYASAI/master
[REV] change project
2 parents 23a26ef + 473e62a commit 813a2b4
Copy full SHA for 813a2b4

File tree

Expand file treeCollapse file tree

87 files changed

+68571
-216
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

87 files changed

+68571
-216
lines changed

‎.gitignore

Copy file name to clipboard
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
target

‎Profile

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: java $JAVA_OPTS -jar target/spring-boot-demo-0.0.1.jar

‎README.md

Copy file name to clipboard
+1-18Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1 @@
1-
# java-maven-demo
2-
3-
通过源代码创建,云帮平台会自动识别为java-mavan项目,通过maven构建并打包为war
4-
5-
## 本地运行
6-
7-
确保本地环境安装了Java和Maven
8-
9-
```bash
10-
$ git clone https://github.com/goodrain-apps/java-maven-demo.git
11-
$ cd java-maven-demo
12-
$ mvn install
13-
$ java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war
14-
```
15-
16-
## 部署到云帮
17-
18-
按照 [新建应用-源码构建](https://www.rainbond.com/docs/stable/user-lang-docs/java/docs/stable/user-app-docs/addapp/addapp-code.html) 的步骤操作,当代码提交完成后,平台就能够识别出项目所使用的语言。
1+
# spring-boot-demo

‎java-maven-demo.iml

Copy file name to clipboard
+88Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3+
<component name="FacetManager">
4+
<facet type="Spring" name="Spring">
5+
<configuration />
6+
</facet>
7+
<facet type="web" name="Web">
8+
<configuration>
9+
<webroots />
10+
<sourceRoots>
11+
<root url="file://$MODULE_DIR$/src/main/java" />
12+
<root url="file://$MODULE_DIR$/src/main/resources" />
13+
</sourceRoots>
14+
</configuration>
15+
</facet>
16+
</component>
17+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
18+
<output url="file://$MODULE_DIR$/target/classes" />
19+
<output-test url="file://$MODULE_DIR$/target/test-classes" />
20+
<content url="file://$MODULE_DIR$">
21+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
22+
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
23+
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
24+
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
25+
<excludeFolder url="file://$MODULE_DIR$/target" />
26+
</content>
27+
<orderEntry type="inheritedJdk" />
28+
<orderEntry type="sourceFolder" forTests="false" />
29+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.2.RELEASE" level="project" />
30+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.2.RELEASE" level="project" />
31+
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.4.RELEASE" level="project" />
32+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.2.RELEASE" level="project" />
33+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.2.RELEASE" level="project" />
34+
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
35+
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
36+
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.1" level="project" />
37+
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.1" level="project" />
38+
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
39+
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
40+
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.4.RELEASE" level="project" />
41+
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.4.RELEASE" level="project" />
42+
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
43+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.2.RELEASE" level="project" />
44+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.2.RELEASE" level="project" />
45+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8" level="project" />
46+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
47+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8" level="project" />
48+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.8" level="project" />
49+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.8" level="project" />
50+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.8" level="project" />
51+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.1.2.RELEASE" level="project" />
52+
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:9.0.14" level="project" />
53+
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:9.0.14" level="project" />
54+
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:9.0.14" level="project" />
55+
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.14.Final" level="project" />
56+
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
57+
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
58+
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
59+
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.4.RELEASE" level="project" />
60+
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.4.RELEASE" level="project" />
61+
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.1.4.RELEASE" level="project" />
62+
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.4.RELEASE" level="project" />
63+
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.4.RELEASE" level="project" />
64+
<orderEntry type="library" scope="RUNTIME" name="Maven: org.springframework.boot:spring-boot-devtools:2.1.2.RELEASE" level="project" />
65+
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.1.2.RELEASE" level="project" />
66+
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.1.2.RELEASE" level="project" />
67+
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.1.2.RELEASE" level="project" />
68+
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
69+
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
70+
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
71+
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
72+
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
73+
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
74+
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.11.1" level="project" />
75+
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.23.4" level="project" />
76+
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.9.7" level="project" />
77+
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.9.7" level="project" />
78+
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
79+
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
80+
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
81+
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
82+
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
83+
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.4.RELEASE" level="project" />
84+
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.2" level="project" />
85+
<orderEntry type="library" name="Maven: c3p0:c3p0:0.9.0.4" level="project" />
86+
<orderEntry type="library" name="Maven: mysql:mysql-connector-java:8.0.13" level="project" />
87+
</component>
88+
</module>

‎maven-demo-web.iml

Copy file name to clipboardExpand all lines: maven-demo-web.iml
-34Lines changed: 0 additions & 34 deletions
This file was deleted.

‎pom.xml

Copy file name to clipboard
+63-10Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,75 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>org.springframework.boot</groupId>
7+
<artifactId>spring-boot-starter-parent</artifactId>
8+
<version>2.1.2.RELEASE</version>
9+
<relativePath/> <!-- lookup parent from repository -->
10+
</parent>
411
<groupId>com.goodrain</groupId>
5-
<artifactId>demo</artifactId>
6-
<packaging>war</packaging>
7-
<version>1.0-SNAPSHOT</version>
8-
<name>demo Maven Webapp</name>
12+
<artifactId>java-maven-demo</artifactId>
13+
<version>0.0.1</version>
14+
<name>spring-boot-demo</name>
15+
<description>Spring Boot Demo for Goodrain</description>
16+
917
<properties>
10-
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
18+
<java.version>1.8</java.version>
1119
</properties>
1220

1321
<dependencies>
1422
<dependency>
15-
<groupId>javax.servlet</groupId>
16-
<artifactId>servlet-api</artifactId>
17-
<version>2.5</version>
18-
<scope>provided</scope>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter</artifactId>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.springframework.boot</groupId>
28+
<artifactId>spring-boot-starter-web</artifactId>
29+
</dependency>
30+
31+
<dependency>
32+
<groupId>org.springframework.boot</groupId>
33+
<artifactId>spring-boot-devtools</artifactId>
34+
<scope>runtime</scope>
35+
</dependency>
36+
<dependency>
37+
<groupId>org.springframework.boot</groupId>
38+
<artifactId>spring-boot-starter-test</artifactId>
39+
<scope>test</scope>
40+
</dependency>
41+
42+
<dependency>
43+
<groupId>c3p0</groupId>
44+
<artifactId>c3p0</artifactId>
45+
<version>0.9.0.4</version>
46+
</dependency>
47+
48+
<dependency>
49+
<groupId>mysql</groupId>
50+
<artifactId>mysql-connector-java</artifactId>
1951
</dependency>
2052
</dependencies>
2153

54+
<build>
55+
<plugins>
56+
<plugin>
57+
<groupId>org.springframework.boot</groupId>
58+
<artifactId>spring-boot-maven-plugin</artifactId>
59+
</plugin>
60+
<plugin>
61+
<groupId>org.apache.maven.plugins</groupId>
62+
<artifactId>maven-compiler-plugin</artifactId>
63+
<configuration>
64+
<source>${java.version}</source>
65+
<target>${java.version}</target>
66+
</configuration>
67+
</plugin>
68+
<plugin>
69+
<groupId>org.apache.maven.plugins</groupId>
70+
<artifactId>maven-dependency-plugin</artifactId>
71+
</plugin>
72+
</plugins>
73+
</build>
74+
2275
</project>
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.goodrain.springbootdemo;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
public class SpringBootDemoApplication {
8+
9+
public static void main(String[] args) {
10+
SpringApplication.run(SpringBootDemoApplication.class, args);
11+
}
12+
13+
}
14+
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.goodrain.springbootdemo.config;
2+
3+
import org.springframework.context.annotation.Configuration;
4+
5+
@Configuration
6+
public class AppConfig {
7+
}
+39Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.goodrain.springbootdemo.controller;
2+
3+
import com.goodrain.springbootdemo.service.DBInfoService;
4+
import com.goodrain.springbootdemo.vo.RestResponse;
5+
import org.springframework.beans.factory.annotation.Autowired;
6+
import org.springframework.web.bind.annotation.CrossOrigin;
7+
import org.springframework.web.bind.annotation.GetMapping;
8+
import org.springframework.web.bind.annotation.RequestMapping;
9+
import org.springframework.web.bind.annotation.RestController;
10+
11+
import java.sql.SQLException;
12+
import java.util.List;
13+
14+
@RestController
15+
@RequestMapping("/dbinfo")
16+
public class DBController {
17+
18+
@Autowired
19+
public DBInfoService dbInfoService;
20+
21+
@GetMapping("ping")
22+
@CrossOrigin(origins = "*")
23+
public RestResponse<Boolean> isConnected() throws SQLException {
24+
RestResponse<Boolean> resp = new RestResponse<>();
25+
resp.setCode("1001");
26+
resp.setSuccess(0);
27+
resp.setMsg("ok");
28+
resp.setData(!dbInfoService.isClosed());
29+
return resp;
30+
}
31+
32+
@GetMapping("list-tables")
33+
@CrossOrigin(origins = "*")
34+
public RestResponse<List<String>> listTables() throws SQLException {
35+
List<String> list = dbInfoService.listTables();
36+
RestResponse<List<String>> resp = new RestResponse<>(0, "1002", "ok", list);
37+
return resp;
38+
}
39+
}
+38Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.goodrain.springbootdemo.controller;
2+
3+
import com.goodrain.springbootdemo.service.FoobarService;
4+
import com.goodrain.springbootdemo.vo.GreetingReqVO;
5+
import com.goodrain.springbootdemo.vo.RestResponse;
6+
import org.springframework.beans.factory.annotation.Autowired;
7+
import org.springframework.web.bind.annotation.*;
8+
9+
import javax.validation.Valid;
10+
import java.util.List;
11+
12+
@RestController
13+
@RequestMapping("/foobar")
14+
public class FoobarController {
15+
@Autowired
16+
private FoobarService foobarService;
17+
18+
@GetMapping("/list-env")
19+
public RestResponse<List<String>> listEnv() {
20+
List<String> envs = foobarService.listEnv();
21+
RestResponse<List<String>> res = new RestResponse<>();
22+
res.setSuccess(0);
23+
res.setCode("3000");
24+
res.setMsg("");
25+
res.setData(envs);
26+
return res;
27+
}
28+
29+
@PostMapping("/greeting")
30+
public RestResponse<String> greeting(@Valid @RequestBody GreetingReqVO greetingReqVO) {
31+
RestResponse<String> res = new RestResponse<>();
32+
res.setSuccess(0);
33+
res.setCode("4000");
34+
res.setMsg("");
35+
res.setData(greetingReqVO.getName());
36+
return res;
37+
}
38+
}
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.goodrain.springbootdemo.controller;
2+
3+
import org.springframework.stereotype.Controller;
4+
import org.springframework.web.bind.annotation.GetMapping;
5+
6+
@Controller
7+
public class IndexController {
8+
9+
@GetMapping("/")
10+
public String index() {
11+
return "/index.html";
12+
}
13+
}
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package com.goodrain.springbootdemo.controller;
2+
3+
import com.goodrain.springbootdemo.service.ProxyService;
4+
import com.goodrain.springbootdemo.vo.ProxyReqVO;
5+
import com.goodrain.springbootdemo.vo.RestResponse;
6+
import org.springframework.beans.factory.annotation.Autowired;
7+
import org.springframework.web.bind.annotation.*;
8+
9+
import javax.validation.Valid;
10+
import java.io.IOException;
11+
12+
@RestController
13+
public class ProxyController {
14+
@Autowired
15+
public ProxyService proxyService;
16+
17+
@RequestMapping(value = "/proxy", method = RequestMethod.POST, produces = "application/json")
18+
public String proxyGet(@Valid @RequestBody ProxyReqVO proxyReqVO) throws IOException {
19+
return proxyService.doProxy(proxyReqVO);
20+
}
21+
}
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.goodrain.springbootdemo.dao;
2+
3+
import java.sql.SQLException;
4+
import java.util.List;
5+
6+
public interface DBInfoDao {
7+
List<String> listTables(String db) throws SQLException;
8+
}
9+

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.