Skip to content

Commit 2a963f9

Browse files
authored
Fixes #4546 - Add ability to override default DataSource (#4614)
1 parent efd88f6 commit 2a963f9

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

extension/datasource/pom.xml

+7
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,11 @@
7272
</plugin>
7373
</plugins>
7474
</build>
75+
76+
<distributionManagement>
77+
<site>
78+
<id>default</id>
79+
<url>file:///tmp/piranha/extension/datasource/</url>
80+
</site>
81+
</distributionManagement>
7582
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Piranha DataSource Extension
2+
3+
The DataSource extension delivers you with a default DataSource in a Piranha runtime.
4+
5+
## Override the default DataSource using web.xml
6+
7+
You override the default DataSource using the snippet below:
8+
9+
```xml
10+
<data-source>
11+
<name>java:comp/DefaultDataSource</name>
12+
<class-name>my.CustomDataSource</class-name>
13+
<url>jdbc:custom://localhost:3306/mydb</url>
14+
<user>myuser</user>
15+
<password>mypassword</password>
16+
<property>
17+
<name>myProperty</name>
18+
<value>myValue</value>
19+
</property>
20+
</data-source>
21+
```
22+
23+
For runtimes that do not include the web.xml extension you will need to add it if you want
24+
to override the default DataSource as described above. You can do this by adding the
25+
following dependency to your pom.xml:
26+
27+
```xml
28+
<dependency>
29+
<groupId>cloud.piranha.extension</groupId>
30+
<artifactId>piranha-extension-webxml</artifactId>
31+
<version>${piranha.version}</version>
32+
</dependency>
33+
```
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project>
4+
<body>
5+
<menu name="Overview">
6+
<item name="Introduction" href="index.html"/>
7+
</menu>
8+
</body>
9+
</project>

0 commit comments

Comments
 (0)