Commit 834582c5 by Yiming Liu

Merge pull request #4 from yiming187/pom_update

Update parent pom.xml
parents abec6212 2108daae
......@@ -14,3 +14,5 @@ hs_err_pid*
.classpath
.project
target
.settings
......@@ -24,13 +24,19 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
spring.datasource.url = jdbc:h2:file:~/fxapolloconfigdb
spring.datasource.username = sa
spring.datasource.password = sa
......@@ -25,12 +25,4 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
......@@ -24,13 +24,18 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
package com.ctrip.apollo.portal.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
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;
@RestController
@RequestMapping("/apps")
public class AppController {
@Autowired
private AppRepository appRepository;
@RequestMapping("")
public Page<App> list() {
Pageable pageable = new PageRequest(0, 10);
return appRepository.findAll(pageable);
}
@RequestMapping(value = "", method = RequestMethod.POST)
public App create() {
App ramdomApp = new App();
return appRepository.save(ramdomApp);
}
}
......@@ -4,9 +4,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/")
public class SampleController {
@RequestMapping("/")
@RequestMapping("")
public String home() {
return "Hello World!";
}
......
package com.ctrip.apollo.portal.entities;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import lombok.Data;
@Entity
@Data
public class App implements Serializable {
/**
*
*/
private static final long serialVersionUID = 7348554309210401557L;
@Id
private String id;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private String owner;
@Column
private String ownerPhone;
@Column
private String ownerMail;
@Column
private Date createTimestamp;
@Column
private Date lastUpdatedTimestamp;
}
package com.ctrip.apollo.portal.repository;
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);
}
spring.datasource.url = jdbc:h2:file:~/fxapolloportaldb
spring.datasource.username = sa
spring.datasource.password = sa
spring.datasource.driver-class-name = org.h2.Driver
spring.datasource.url = jdbc:h2:file:~/fxapolloportaldb
spring.datasource.username = sa
spring.datasource.password = sa
spring.h2.console.enabled = true
\ No newline at end of file
......@@ -15,36 +15,18 @@
<module>apollo-portal</module>
<module>apollo-assembly</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.ctrip.apollo</groupId>
<artifactId>apollo-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ctrip.apollo</groupId>
<artifactId>apollo-metaserver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ctrip.apollo</groupId>
<artifactId>apollo-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ctrip.apollo</groupId>
<artifactId>apollo-configserver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.ctrip.apollo</groupId>
<artifactId>apollo-portal</artifactId>
<version>${project.version}</version>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.ctrip.apollo</groupId>
<artifactId>apollo-assembly</artifactId>
<artifactId>apollo-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
......@@ -65,15 +47,46 @@
<artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.8</version>
</dependency>
<!--for test -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.191</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.source}</source>
<target>${java.target}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<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>
</build>
<distributionManagement>
<repository>
<id>releases</id>
......
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