You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/10/28 12:19:31 UTC

[camel-spring-boot-examples] branch master updated: fixed rest jpa example

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot-examples.git


The following commit(s) were added to refs/heads/master by this push:
     new 1072c63  fixed rest jpa example
1072c63 is described below

commit 1072c63ca54d653031da23bfca221ea189cf88f8
Author: Farid Guliyev <fg...@gmail.com>
AuthorDate: Tue Oct 27 13:57:30 2020 -0400

    fixed rest jpa example
---
 .../example/spring/boot/rest/jpa/Application.java  |  1 +
 .../src/main/resources/application.yml             | 25 +++++++++++++++++-----
 .../spring/boot/rest/jpa/ApplicationTest.java      |  2 +-
 3 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/camel-example-spring-boot-rest-jpa/src/main/java/org/apache/camel/example/spring/boot/rest/jpa/Application.java b/camel-example-spring-boot-rest-jpa/src/main/java/org/apache/camel/example/spring/boot/rest/jpa/Application.java
index ad74c08..8ed8fc7 100644
--- a/camel-example-spring-boot-rest-jpa/src/main/java/org/apache/camel/example/spring/boot/rest/jpa/Application.java
+++ b/camel-example-spring-boot-rest-jpa/src/main/java/org/apache/camel/example/spring/boot/rest/jpa/Application.java
@@ -41,6 +41,7 @@ public class Application extends SpringBootServletInitializer {
         @Override
         public void configure() {
             restConfiguration()
+                .component("servlet")
                 .contextPath("/camel-rest-jpa").apiContextPath("/api-doc")
                     .apiProperty("api.title", "Camel REST API")
                     .apiProperty("api.version", "1.0")
diff --git a/camel-example-spring-boot-rest-jpa/src/main/resources/application.yml b/camel-example-spring-boot-rest-jpa/src/main/resources/application.yml
index 91f83c2..badb2fd 100644
--- a/camel-example-spring-boot-rest-jpa/src/main/resources/application.yml
+++ b/camel-example-spring-boot-rest-jpa/src/main/resources/application.yml
@@ -1,4 +1,4 @@
-#
+
 # Licensed to the Apache Software Foundation (ASF) under one or more
 # contributor license agreements.  See the NOTICE file distributed with
 # this work for additional information regarding copyright ownership.
@@ -35,23 +35,38 @@ mysql:
     port:     3306
     # The database to use, can be customized using the 'MYSQL_SERVICE_DATABASE'
     # env variable
-    database: sampledb
+    database: camelsampledb
+    # The database username, can be customized using the 'MYSQL_SERVICE_USERNAME'
+    # env variable
+    username: cameluser
+    # The database password, can be customized using the 'MYSQL_SERVICE_PASSWORD'
+    # env variable
+    password: cameluser
 
 spring:
   # Spring JDBC configuration
   datasource:
-    url:      jdbc:mysql://${mysql.service.host}:${mysql.service.port}/${mysql.service.database}
+    url:      jdbc:mysql://${mysql.service.host}:${mysql.service.port}/${mysql.service.database}?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
     username: ${mysql.service.username}
     password: ${mysql.service.password}
+    initialization-mode: always
 
   # Spring Data JPA configuration
   jpa:
+    database: mysql
+    generate-ddl: false
+    open-in-view: false
     hibernate:
       # To be updated in real production usage!
       ddl-auto: create-drop
-    show-sql: false
+    show-sql: true
+    properties:
+      hibernate:
+        format_sql: true
+        use_sql_comment: true
+    database-platform: org.hibernate.dialect.MySQL8Dialect
 
 # The application configuration properties
 example:
   generateOrderPeriod: 10000
-  processOrderPeriod: 30000
+  processOrderPeriod: 30000
\ No newline at end of file
diff --git a/camel-example-spring-boot-rest-jpa/src/test/java/org/apache/camel/example/spring/boot/rest/jpa/ApplicationTest.java b/camel-example-spring-boot-rest-jpa/src/test/java/org/apache/camel/example/spring/boot/rest/jpa/ApplicationTest.java
index b0fd59a..0894e2d 100644
--- a/camel-example-spring-boot-rest-jpa/src/test/java/org/apache/camel/example/spring/boot/rest/jpa/ApplicationTest.java
+++ b/camel-example-spring-boot-rest-jpa/src/test/java/org/apache/camel/example/spring/boot/rest/jpa/ApplicationTest.java
@@ -39,7 +39,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 
 @CamelSpringBootTest
 @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
-@Disabled("TODO: Fix me")
+@Disabled("Remove if you have running MySQL v8 instance on port 3306 and with user cameluser")
 public class ApplicationTest {
 
     @Autowired