摘要:查看訪問參考
postgresql
postgresql: image: "postgres:9.4" volumes_from: - postgresql_data environment: POSTGRES_PASSWORD: mypwd #set default password for postgres ports: - 5432:5432 postgresql_data: image: cogniteev/echo command: echo "Data Container for PostgreSQL" volumes: - /var/lib/postgresql/data
mac client
psequel
查看
postgrestpostgrest: build: postgrest/ ports: - 3000:3000 links: - postgresql restart: always environment: - POSTGRES_DB_NAME=postgres ##default database postgres, default user name postgres - POSTGRES_ADDRESS=postgresql - POSTGRES_PORT=5432 - POSTGRES_PASSWORD=mypwd
訪問
http://192.168.99.100:3000/app_user
http://192.168.99.100:3000/app_user?select=username
http://192.168.99.100:3000/app_user?username=eq.hello1
pom
postgresql postgresql 9.1-901-1.jdbc4 org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-data-rest
application.yml
spring: jpa: database: POSTGRESQL show-sql: true hibernate.ddl-auto: update database: driverClassName: org.postgresql.Driver datasource: platform: postgres url: jdbc:postgresql://postgresql:5432/postgres username: postgres password: mypwd
configuration
@Configuration @EnableJpaRepositories(basePackages = "com.codecraft.dao") @EnableAutoConfiguration @EntityScan(basePackages = {"com.codecraft.domain"}) public class JpaConfiguration { }
domain
import javax.persistence.*; @Entity public class AppUser { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id", nullable = false) private Long id; @Column(name = "username", nullable = false) private String username; public AppUser() { } public AppUser(String username) { this.username = username; } public AppUser(long id, String username) { this.id = id; this.username = username; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } @Override public String toString() { return "User{" + "id=" + id + ", username="" + username + """ + "}"; } }
dao
import com.codecraft.domain.AppUser; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; @Repository public interface UserRepository extends CrudRepository{ }
controller
@RestController @RequestMapping(value = "/product", produces = MediaType.APPLICATION_JSON_VALUE) public class ProductUserController { @Autowired UserRepository userRepository; @RequestMapping(value = "/user/{username}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public AppUser create(@PathVariable String username) { return userRepository.save(new AppUser(username)); } @RequestMapping(value = "/user", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public List參考findAll() { final List resultList = new ArrayList<>(); final Iterable all = userRepository.findAll(); all.forEach(new Consumer () { @Override public void accept(AppUser appUser) { resultList.add(appUser); } }); return resultList; } }
spring-boot-postgres-sample
docker-postgrest
docker-recipes-postgrest
docker-compose-postgresql
docker-postgrest-with-postgresql
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/38938.html
摘要:查看訪問參考 postgresql postgresql: image: postgres:9.4 volumes_from: - postgresql_data environment: POSTGRES_PASSWORD: mypwd #set default password for postgres ports: - 5432:543...
摘要:介紹搭建與維護基于鏡像圖片來自于公社前端,用于頁面及走或協議后端服務,采用框架,通過實現后臺服務及多進程開啟服務,用于用戶上傳進行版本克隆及上傳。 gitlab介紹 GitLab搭建與維護(基于Docker鏡像sameersbn/docker-gitlab) 圖片來自于: Linux公社(https://www.linuxidc.com) showImg(https://segment...
摘要:哪吒社區技能樹打卡打卡貼函數式接口簡介領域優質創作者哪吒公眾號作者架構師奮斗者掃描主頁左側二維碼,加入群聊,一起學習一起進步歡迎點贊收藏留言前情提要無意間聽到領導們的談話,現在公司的現狀是碼農太多,但能獨立帶隊的人太少,簡而言之,不缺干 ? 哪吒社區Java技能樹打卡?【打卡貼 day2...
摘要:中使用打包直接在的時候執行指定了的名稱為指定了鏡像名為實例文件在文件夾下面建立的內容也可以直接在中用設置定義存儲位置定義應用名稱每隔小時分割為表示以分為邊界添加依賴鏡像查看日志工程 docker-maven-plugin app org.springframework.boo...
摘要:中使用打包直接在的時候執行指定了的名稱為指定了鏡像名為實例文件在文件夾下面建立的內容也可以直接在中用設置定義存儲位置定義應用名稱每隔小時分割為表示以分為邊界添加依賴鏡像查看日志工程 docker-maven-plugin app org.springframework.boo...
閱讀 1228·2021-09-26 09:46
閱讀 1582·2021-09-06 15:00
閱讀 713·2019-08-30 15:52
閱讀 1116·2019-08-29 13:10
閱讀 1277·2019-08-26 13:47
閱讀 1479·2019-08-26 13:35
閱讀 2028·2019-08-23 18:38
閱讀 721·2019-08-23 17:59