summaryrefslogtreecommitdiff
path: root/microservices/03-resource-server/src/main/resources
diff options
context:
space:
mode:
authorKamal Wickramanayake <kamal@inbox.lk>2026-07-03 19:02:36 +0530
committerKamal Wickramanayake <kamal@inbox.lk>2026-07-03 19:02:36 +0530
commitaa122113ade36f02dc8fdbebdf1232b5c4b8742c (patch)
treec345b83db6c769bf5e72a09e3f19d43431961695 /microservices/03-resource-server/src/main/resources
parentb221a83ecef1dd7f9583d5107017d24e668205a6 (diff)
Microservice sample projects
Diffstat (limited to 'microservices/03-resource-server/src/main/resources')
-rw-r--r--microservices/03-resource-server/src/main/resources/application.yaml40
-rw-r--r--microservices/03-resource-server/src/main/resources/data.sql8
2 files changed, 48 insertions, 0 deletions
diff --git a/microservices/03-resource-server/src/main/resources/application.yaml b/microservices/03-resource-server/src/main/resources/application.yaml
new file mode 100644
index 0000000..aa42301
--- /dev/null
+++ b/microservices/03-resource-server/src/main/resources/application.yaml
@@ -0,0 +1,40 @@
+server:
+ port: 8052
+ address: 127.0.0.1
+ servlet:
+ context-path: /myservices
+
+# logging:
+# level:
+# org.springframework.security: trace
+
+spring:
+ application:
+ name: resource-server
+
+ security:
+ oauth2:
+ resourceserver:
+ jwt:
+ issuer-uri: http://127.0.0.1:8051
+
+ datasource:
+ url: jdbc:h2:mem:testdb
+ driver-class-name: org.h2.Driver
+ username: sa
+ password: password
+ h2:
+ console:
+ enabled: true
+ path: /h2-console # H2 Console: http://localhost:8052/myservices/h2-console
+ jpa:
+ # database-platform: org.hibernate.dialect.H2Dialect
+ hibernate:
+ ddl-auto: update
+ show-sql: true
+ defer-datasource-initialization: true # schema.sql and data.sql are executed after Hibernate/JPA auto-creates database tables.
+
+ # Always execute initialization scripts (resources/schema.sql, resources/data.sql) on startup
+ sql:
+ init:
+ mode: always
diff --git a/microservices/03-resource-server/src/main/resources/data.sql b/microservices/03-resource-server/src/main/resources/data.sql
new file mode 100644
index 0000000..173ee0e
--- /dev/null
+++ b/microservices/03-resource-server/src/main/resources/data.sql
@@ -0,0 +1,8 @@
+INSERT INTO user_account (username, password, description) VALUES ('admin','$argon2id$v=19$m=16,t=2,p=1$YnJERWhhY0RxV1hGMFNWVg$OHRvhGZx1x9KqCoVZOfUD2TkJc+HQB5SamgYejw+K2Y', 'Admin user');
+INSERT INTO user_account (username, password, description) VALUES ('user1','$argon2id$v=19$m=16,t=2,p=1$YnJERWhhY0RxV1hGMFNWVg$OHRvhGZx1x9KqCoVZOfUD2TkJc+HQB5SamgYejw+K2Y', 'Normal user 1');
+
+INSERT INTO user_roles (user_id, role_name) VALUES (1, 'ADMIN');
+INSERT INTO user_roles (user_id, role_name) VALUES (2, 'USER');
+
+INSERT INTO post (title, author, description) VALUES ('The rabbit jumped over the moon.', 'Kamal', 'Once upon a time there was a rabbit. And then...');
+INSERT INTO post (title, author, description) VALUES ('The fox jumped over the moon.', 'Kamal', 'Once upon a time there was a fox. And then...'); \ No newline at end of file