Skip to content

Commit 2ca0226

Browse files
committed
Fixed instructions and updated dependencies
1 parent 294365f commit 2ca0226

File tree

4 files changed

+95
-92
lines changed

4 files changed

+95
-92
lines changed

README.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,14 @@ CREATE OR REPLACE TABLE demo.person(
6767

6868
## Run the web application
6969

70-
Build the Java web application using Maven:
70+
Build and run the Java web application using Maven:
7171

7272
```shell
7373
# cd read-write-split-java-app
74-
mvn package
74+
mvn
7575
```
7676

77-
Run the application:
78-
79-
```shell
80-
java -jar target/webapp.jar
81-
```
77+
Alternatively you can build it with `mvn package -P production` and run it with `java -jar target/webapp.jar`.
8278

8379
Access the application in your browser at http://localhost:8080. Insert and update data and refresh the table to see how writes are performed on one server ID (the one corresponding to the primary node), but reads are load-balanced on other servers (replicas).
8480

docker-compose.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ services:
2222
image: alejandrodu/mariadb-maxscale
2323
command: --admin_host 0.0.0.0 --admin_secure_gui false
2424
ports:
25-
- "4000:4000"
25+
- "3306:4000"
2626
- "8989:8989"
2727
- "27017:27017"
2828
environment:

pom.xml

+90-83
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4-
<modelVersion>4.0.0</modelVersion>
5-
<groupId>com.example.application</groupId>
6-
<artifactId>webapp</artifactId>
7-
<name>webapp</name>
8-
<version>1.0-SNAPSHOT</version>
9-
<packaging>jar</packaging>
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>com.example.application</groupId>
7+
<artifactId>webapp</artifactId>
8+
<name>webapp</name>
9+
<version>1.0-SNAPSHOT</version>
10+
<packaging>jar</packaging>
1011

11-
<properties>
12-
<java.version>17</java.version>
13-
<vaadin.version>24.1.0</vaadin.version>
14-
</properties>
12+
<properties>
13+
<java.version>17</java.version>
14+
<vaadin.version>24.1.4</vaadin.version>
15+
</properties>
1516

16-
<parent>
17-
<groupId>org.springframework.boot</groupId>
18-
<artifactId>spring-boot-starter-parent</artifactId>
19-
<version>3.1.0</version>
20-
</parent>
17+
<parent>
18+
<groupId>org.springframework.boot</groupId>
19+
<artifactId>spring-boot-starter-parent</artifactId>
20+
<version>3.1.0</version>
21+
</parent>
2122

22-
<repositories>
23-
<repository>
24-
<id>Vaadin Directory</id>
25-
<url>https://maven.vaadin.com/vaadin-addons</url>
26-
</repository>
27-
</repositories>
23+
<repositories>
24+
<repository>
25+
<id>Vaadin Directory</id>
26+
<url>https://maven.vaadin.com/vaadin-addons</url>
27+
</repository>
28+
</repositories>
2829

29-
<dependencyManagement>
30-
<dependencies>
31-
<dependency>
32-
<groupId>com.vaadin</groupId>
33-
<artifactId>vaadin-bom</artifactId>
34-
<version>${vaadin.version}</version>
35-
<type>pom</type>
36-
<scope>import</scope>
37-
</dependency>
38-
</dependencies>
39-
</dependencyManagement>
30+
<dependencyManagement>
31+
<dependencies>
32+
<dependency>
33+
<groupId>com.vaadin</groupId>
34+
<artifactId>vaadin-bom</artifactId>
35+
<version>${vaadin.version}</version>
36+
<type>pom</type>
37+
<scope>import</scope>
38+
</dependency>
39+
</dependencies>
40+
</dependencyManagement>
4041

41-
<dependencies>
42-
43-
<dependency>
44-
<groupId>org.springframework.boot</groupId>
45-
<artifactId>spring-boot-starter-actuator</artifactId>
46-
</dependency>
42+
<dependencies>
43+
<dependency>
44+
<groupId>org.springframework.boot</groupId>
45+
<artifactId>spring-boot-starter-actuator</artifactId>
46+
</dependency>
4747

4848
<dependency>
4949
<groupId>org.mariadb.jdbc</groupId>
@@ -58,57 +58,64 @@
5858
<groupId>com.vaadin</groupId>
5959
<artifactId>vaadin-spring-boot-starter</artifactId>
6060
</dependency>
61-
<dependency>
62-
<groupId>com.vaadin</groupId>
63-
<artifactId>vaadin-core</artifactId>
64-
</dependency>
61+
<dependency>
62+
<groupId>com.vaadin</groupId>
63+
<artifactId>vaadin-core</artifactId>
64+
</dependency>
6565
<dependency>
6666
<groupId>org.vaadin.crudui</groupId>
6767
<artifactId>crudui</artifactId>
68-
<version>6.2.0</version>
69-
</dependency>
70-
<dependency>
71-
<groupId>org.springframework.boot</groupId>
72-
<artifactId>spring-boot-devtools</artifactId>
73-
<optional>true</optional>
74-
</dependency>
68+
<version>7.1.0</version>
69+
</dependency>
70+
<dependency>
71+
<groupId>org.springframework.boot</groupId>
72+
<artifactId>spring-boot-devtools</artifactId>
73+
<optional>true</optional>
74+
</dependency>
7575
<dependency>
7676
<groupId>org.projectlombok</groupId>
7777
<artifactId>lombok</artifactId>
7878
<optional>true</optional>
7979
</dependency>
80-
<dependency>
81-
<groupId>org.springframework.boot</groupId>
82-
<artifactId>spring-boot-starter-test</artifactId>
83-
<scope>test</scope>
84-
</dependency>
85-
</dependencies>
80+
<dependency>
81+
<groupId>org.springframework.boot</groupId>
82+
<artifactId>spring-boot-starter-test</artifactId>
83+
<scope>test</scope>
84+
</dependency>
85+
</dependencies>
8686

87-
<build>
87+
<build>
8888
<finalName>${project.artifactId}</finalName>
89-
<plugins>
90-
<plugin>
91-
<groupId>org.springframework.boot</groupId>
92-
<artifactId>spring-boot-maven-plugin</artifactId>
93-
<configuration>
94-
<jvmArguments>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5427</jvmArguments>
95-
<wait>500</wait>
96-
<maxAttempts>240</maxAttempts>
97-
</configuration>
98-
</plugin>
99-
<plugin>
100-
<groupId>com.vaadin</groupId>
101-
<artifactId>vaadin-maven-plugin</artifactId>
102-
<version>${vaadin.version}</version>
103-
<executions>
104-
<execution>
105-
<goals>
106-
<goal>prepare-frontend</goal>
107-
</goals>
108-
</execution>
109-
</executions>
110-
</plugin>
111-
</plugins>
112-
</build>
113-
114-
</project>
89+
<defaultGoal>spring-boot:run</defaultGoal>
90+
<plugins>
91+
<plugin>
92+
<groupId>org.springframework.boot</groupId>
93+
<artifactId>spring-boot-maven-plugin</artifactId>
94+
</plugin>
95+
</plugins>
96+
</build>
97+
<profiles>
98+
<profile>
99+
<id>production</id>
100+
<build>
101+
<plugins>
102+
<plugin>
103+
<groupId>com.vaadin</groupId>
104+
<artifactId>vaadin-maven-plugin</artifactId>
105+
<version>${vaadin.version}</version>
106+
<executions>
107+
<execution>
108+
<id>frontend</id>
109+
<phase>compile</phase>
110+
<goals>
111+
<goal>prepare-frontend</goal>
112+
<goal>build-frontend</goal>
113+
</goals>
114+
</execution>
115+
</executions>
116+
</plugin>
117+
</plugins>
118+
</build>
119+
</profile>
120+
</profiles>
121+
</project>

src/main/resources/application.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
spring.datasource.url=jdbc:mariadb://localhost:4000/demo
1+
spring.datasource.url=jdbc:mariadb://localhost/demo
22
spring.datasource.username=user
33
spring.datasource.password=Password123!
44

0 commit comments

Comments
 (0)