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* ...@@ -14,3 +14,5 @@ hs_err_pid*
.classpath .classpath
.project .project
target target
.settings
...@@ -24,13 +24,19 @@ ...@@ -24,13 +24,19 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> <dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
</plugin> </dependency>
</plugins> <dependency>
</build> <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> </project>
spring.datasource.url = jdbc:h2:file:~/fxapolloconfigdb
spring.datasource.username = sa
spring.datasource.password = sa
...@@ -25,12 +25,4 @@ ...@@ -25,12 +25,4 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project> </project>
...@@ -24,13 +24,18 @@ ...@@ -24,13 +24,18 @@
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> <dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-starter-data-jpa</artifactId>
</plugin> </dependency>
</plugins> <dependency>
</build> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</project> </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; ...@@ -4,9 +4,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/")
public class SampleController { public class SampleController {
@RequestMapping("/") @RequestMapping("")
public String home() { public String home() {
return "Hello World!"; 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 @@ ...@@ -15,36 +15,18 @@
<module>apollo-portal</module> <module>apollo-portal</module>
<module>apollo-assembly</module> <module>apollo-assembly</module>
</modules> </modules>
<dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.ctrip.apollo</groupId> <groupId>org.projectlombok</groupId>
<artifactId>apollo-core</artifactId> <artifactId>lombok</artifactId>
<version>${project.version}</version> <optional>true</optional>
</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>
</dependency> </dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency> <dependency>
<groupId>com.ctrip.apollo</groupId> <groupId>com.ctrip.apollo</groupId>
<artifactId>apollo-assembly</artifactId> <artifactId>apollo-core</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency> <dependency>
...@@ -65,15 +47,46 @@ ...@@ -65,15 +47,46 @@
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>5.1.38</version> <version>5.1.38</version>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.8</version>
</dependency>
<!--for test --> <!--for test -->
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<version>1.4.191</version> <version>1.4.191</version>
<scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </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> <distributionManagement>
<repository> <repository>
<id>releases</id> <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