Commit f6989346 by Yiming Liu

Update Spring pom.xml

parent b3309f1a
text=auto
\ No newline at end of file
......@@ -21,17 +21,19 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
......@@ -39,4 +41,12 @@
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
......@@ -25,4 +25,12 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
......@@ -21,8 +21,8 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -38,4 +38,12 @@
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
......@@ -5,6 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class PortalApplication {
public static void main(String[] args) throws Exception {
SpringApplication.run(PortalApplication.class, args);
}
......
package com.ctrip.apollo.portal.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/")
public class SampleController {
@RequestMapping("")
public String home() {
return "Hello World!";
}
}
package com.ctrip.apollo.portal.entities;
package com.ctrip.apollo.portal.domain;
import java.io.Serializable;
import java.util.Date;
......
package com.ctrip.apollo.portal.repository;
package com.ctrip.apollo.portal.domain;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
import com.ctrip.apollo.portal.entities.App;
public interface AppRepository extends CrudRepository<App, String> {
Page<App> findAll(Pageable pageable);
......
package com.ctrip.apollo.portal.service;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.ctrip.apollo.portal.domain.App;
import com.ctrip.apollo.portal.domain.AppRepository;
@Service
public class AppService {
@Autowired
private AppRepository appRepository;
public App detail(String appId) {
return appRepository.findOne(appId);
}
public Page<App> list(Pageable pageable) {
return appRepository.findAll(pageable);
}
public App save(App app) {
app.setCreateTimestamp(new Date());
return appRepository.save(app);
}
}
package com.ctrip.apollo.portal.controller;
import java.util.Date;
package com.ctrip.apollo.portal.web;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.ctrip.apollo.portal.entities.App;
import com.ctrip.apollo.portal.repository.AppRepository;
import com.ctrip.apollo.portal.domain.App;
import com.ctrip.apollo.portal.service.AppService;
@RestController
@RequestMapping("/apps")
public class AppController {
@Autowired
private AppRepository appRepository;
@RequestMapping("")
public Page<App> list(@PageableDefault(size = 50) Pageable pageable) {
return appRepository.findAll(pageable);
}
private AppService appService;
@RequestMapping(value = "", method = RequestMethod.POST)
public App create(App app) {
app.setCreateTimestamp(new Date());
return appRepository.save(app);
return appService.save(app);
}
@RequestMapping("/{appid}")
public App detail(@PathVariable String appId) {
return appService.detail(appId);
}
@RequestMapping("")
public Page<App> list(@PageableDefault(size = 50) Pageable pageable) {
return appService.list(pageable);
}
}
spring.datasource.url = jdbc:h2:file:~/fxapolloportaldb
spring.datasource.url = jdbc:h2:file:~/fxapolloportaldb;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.username = sa
spring.datasource.password = sa
spring.datasource.driver-class-name = org.h2.Driver
......@@ -10,7 +10,8 @@ import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.ctrip.apollo.portal.PortalApplicationTestConfiguration;
import com.ctrip.apollo.portal.entities.App;
import com.ctrip.apollo.portal.domain.App;
import com.ctrip.apollo.portal.domain.AppRepository;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = PortalApplicationTestConfiguration.class)
......
......@@ -2,4 +2,3 @@ spring.datasource.url = jdbc:h2:file:~/fxapolloportaldb;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.username = sa
spring.datasource.password = sa
spring.h2.console.enabled = true
\ No newline at end of file
......@@ -7,6 +7,57 @@
<version>0.0.1</version>
<name>Apollo</name>
<packaging>pom</packaging>
<description>Ctrip Configuration Center</description>
<url>https://github.com/ctripcorp/apollo</url>
<organization>
<name>Ctrip, Inc.</name>
<url>http://www.ctrip.com</url>
</organization>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
</license>
</licenses>
<scm>
<url>https://github.com/ctripcorp/apollo</url>
</scm>
<developers>
<developer>
<id>yiming187</id>
<name>Billy(Yiming) Liu</name>
<email>liuyiming.vip at gmail.com</email>
<organization>Ctrip, Inc.</organization>
<organizationUrl>http://www.ctrip.com</organizationUrl>
<roles>
<role>Developer</role>
</roles>
</developer>
<developer>
<id>nobodyiam</id>
<name>Jason(Shun) Song</name>
<email>nobodyiam at gmail.com</email>
<organization>Ctrip, Inc.</organization>
<organizationUrl>http://www.ctrip.com</organizationUrl>
<roles>
<role>Developer</role>
</roles>
</developer>
<developer>
<id>lepdou</id>
<name>Le Zhang</name>
<email>lepdou at gmail.com</email>
<organization>Ctrip, Inc.</organization>
<organizationUrl>http://www.ctrip.com</organizationUrl>
<roles>
<role>Developer</role>
</roles>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<modules>
<module>apollo-core</module>
<module>apollo-metaserver</module>
......@@ -29,13 +80,6 @@
</dependency>
<!--third party -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Angel.SR6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
......@@ -46,36 +90,67 @@
<artifactId>h2</artifactId>
<version>1.4.191</version>
</dependency>
<!-- declare Spring BOMs in order -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config</artifactId>
<version>1.1.0.M5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>${java.source}</source>
<target>${java.target}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.3.3.RELEASE</version>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>${java.source}</source>
<target>${java.target}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.3.3.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
......@@ -127,9 +202,5 @@
</snapshots>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
</project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment