Skip to content

Commit 5f8a9ff

Browse files
authored
Merge pull request #5 from j2joi/main
feat: Spring Framework PetClinic for WLS 12.2.1.4 code
2 parents ae952d6 + 2c74fad commit 5f8a9ff

File tree

129 files changed

+17529
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+17529
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
2+
3+
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
<!--
2+
The code contain in this repository is a fork from https://github.com/spring-projects/spring-framework-petclinic
3+
4+
The following changes were introduced in this version:
5+
* Removed trimDirectiveWhitespaces="true" from tag files under webapp/WEB-INF/tags/*.tag
6+
* Added a WebLogic Descriptor. weblogic.xml
7+
* Removed jetty deployment descriptor
8+
* Added JSTL Tag definition petclinic.tld
9+
* Modified mvc-core-config.xml to include the handler servlet name
10+
<mvc:default-servlet-handler default-servlet-name="default"
11+
* Modifed POM.xml file to include updated dependencies.
12+
* Removed mvnw for Windows.
13+
-->
14+
15+
# Spring PetClinic Sample Application
16+
17+
This repo is a fork of the [spring-projects/spring-framework-petclinic](https://github.com/spring-projects/spring-framework-petclinic).
18+
19+
This version is for the **Oracle WebLogic community** to deploy a Spring based application on a specific **WebLogic Domain** release.
20+
The example follows the same **3-layer architecture** (i.e. presentation --> service --> repository) included in spring-framework-petclinic version.
21+
22+
23+
## Understanding the Spring Petclinic application with a few diagrams
24+
25+
[ TODO: Update with Diagrams ]
26+
27+
## Running petclinic
28+
29+
### Build WebApplication Archive
30+
```bash
31+
git clone https://github.com/oracle-samples/weblogic-examples.git
32+
cd weblogic-examples/12_2_1_4/spring-petclinic
33+
./mvnw clean package
34+
```
35+
36+
### Deploy to WebLogic Domain
37+
38+
#### WebLogic Remote Console
39+
40+
You can use WebLogic Remote Console to manage the deployment process of applications to WebLogic Server.
41+
42+
For general information on the application deployment process, see [Understanding WebLogic Server Deployment](https://docs.oracle.com/pls/topic/lookup?ctx=en/middleware/fusion-middleware/weblogic-remote-console/administer&id=DEPGD-GUID-F6E8BF0B-FBCF-44D2-A33F-13C4EF2E0031) in Deploying Applications to Oracle WebLogic Server.
43+
44+
Installing an application makes its physical file or directory known to WebLogic Server.
45+
46+
This procedure applies to all of the deployment units listed in Supported Deployment Units.
47+
48+
In the Edit Tree, go to Deployments, then App Deployments.
49+
50+
Select New.
51+
52+
Enter a name for the application.
53+
54+
Select the servers and clusters to which you want to deploy the application.
55+
56+
Make the archive file or exploded directory known to the Administration Server.
57+
If the application is on your file system and you need to upload it to the Administration Server, enable the Upload option. Then, beside Source, click Choose File to browse to the application’s location on your system.
58+
If the application is already in the file system of the Administration Server, disable the Upload option. Then, in the Source Path field, enter the file path to the application.
59+
60+
Add a deployment plan, choose another staging mode, or set application behavior at deployment.
61+
62+
Click Create.
63+
64+
You can view the status of running deployment tasks on the Monitoring Tree: Deployments: Deployment Tasks page.
65+
66+
Your new application appears under the App Deployment node. You can make additional changes to the application on this page.
67+
68+
You must start an application before it can process client requests.
69+
70+
#### WebLogic Maven Plugin
71+
WebLogic Server provides support for Maven through the provisioning of plug-ins that enable you to perform various operations on WebLogic Server from within a Maven environment. For more information, see [WebLogic Maven Plugin](https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/depgd/maven_deployer.html)
72+
73+
```bash
74+
./mvnw com.oracle.weblogic:weblogic-maven-plugin:deploy -Dsource=target/petclinic.war -Duser=<WebLogic Admin User> -Dpassword=<WebLogic Password>
75+
```
76+
77+
#### WebLogic Java Deployer.
78+
79+
In order to deploy an application or module to a domain, the deployment file(s) must be accessible to the domain's Administration Server. If the files do not reside on the Administration Server machine or are not available to the Administration Server machine via a network mounted directory, use the -upload option to upload the files before deploying them. For more information, see [WebLogic Java Deployer](https://docs.oracle.com/en/middleware/fusion-middleware/weblogic-server/12.2.1.4/depgd/deploy.html)
80+
81+
```bash
82+
java weblogic.Deployer -adminurl http://<AdminServer IP>:<Port, defaults to 7001> -username <WebLogic Admin User>
83+
-password password=<WebLogic Password> -deploy -upload target/petclinic.war
84+
```
85+
86+
#### WebLogic Admin Console
87+
Oracle WebLogic Server Administration Console is a Web browser-based, graphical user interface that you use to manage an Oracle WebLogic Server domain. It is accessible from any supported Web browser with network access to the Administration Server.
88+
89+
Go to the WebLogic Admin Server Console and Click on Deployments. For more information, see [Using Oracle WebLogic Server Administration Console](https://docs.oracle.com/en/middleware/fusion-middleware/12.2.1.4/asadm/getting-started-managing-oracle-fusion-middleware.html)
90+
91+
92+
You can then access petclinic here: [http://AdminServerIP:7001/](http://localhost:8080/)
93+
94+
95+
96+
97+
## Database configuration
98+
99+
In its default configuration, Petclinic uses an in-memory database (H2) which gets populated at startup with data.
100+
101+
102+
## Working with Petclinic in your IDE
103+
104+
### Prerequisites
105+
The following items should be installed in your system:
106+
* Java 8 or newer (full JDK not a JRE)
107+
* Maven 3.3+ (http://maven.apache.org/install.html)
108+
* git command line tool (https://help.github.com/articles/set-up-git)
109+
* WebLogic 12.2.1.4+
110+
* Your prefered IDE
111+
* Eclipse with the m2e plugin. Note: when m2e is available, there is an m2 icon in Help -> About dialog. If m2e is not there, just follow the install process here: http://www.eclipse.org/m2e/
112+
* [Spring Tools Suite](https://spring.io/tools) (STS)
113+
* IntelliJ IDEA
114+
115+
116+
### Steps:
117+
118+
1) On the command line
119+
```bash
120+
git clone https://github.com/oracle-samples/weblogic-examples.git
121+
cd weblogic-examples/12_2_1_4/spring-petclinic
122+
123+
```
124+
125+
2) Inside Eclipse or STS
126+
```
127+
File -> Import -> Maven -> Existing Maven project
128+
```
129+
Then either build on the command line `./mvnw generate-resources` or using the Eclipse launcher (right click on project and `Run As -> Maven install`) to generate the CSS.
130+
Configure an Oracle WebLogic Domain then deploy the `petclinic.war` file.
131+
132+
3) Inside IntelliJ IDEA
133+
134+
In the main menu, select `File > Open` and select the Petclinic [pom.xml](pom.xml). Click on the `Open` button.
135+
136+
CSS files are generated from the Maven build. You can either build them on the command line `./mvnw generate-resources`
137+
or right click on the `wls-spring-petclinic` project then `Maven -> Generates sources and Update Folders`.
138+
139+
Go to the `Run -> Edit Configuration` then configure a WebLogic Server. Deploy the `petclinic.war` file.
140+
Run the application by clicking on the `Run` icon.
141+
142+
143+
4) Navigate to Petclinic
144+
145+
Visit [http://localhost:8080](http://localhost:8080) in your browser.
146+
147+
148+
## Working with Petclinic in IntelliJ IDEA
149+
150+
### prerequisites
151+
The following items should be installed in your system:
152+
153+
154+
## Looking for something in particular?
155+
156+
| Java Config | |
157+
|-------------|---|
158+
| Java config branch | Petclinic uses XML configuration by default. In case you'd like to use Java Config instead, there is a Java Config branch available [here](https://github.com/spring-petclinic/spring-framework-petclinic/tree/javaconfig) |
159+
160+
| Inside the 'Web' layer | Files |
161+
|------------------------|-------|
162+
| Spring MVC - XML integration | [mvc-view-config.xml](src/main/resources/spring/mvc-view-config.xml) |
163+
| Spring MVC - ContentNegotiatingViewResolver| [mvc-view-config.xml](src/main/resources/spring/mvc-view-config.xml) |
164+
| JSP custom tags | [WEB-INF/tags](src/main/webapp/WEB-INF/tags), [createOrUpdateOwnerForm.jsp](src/main/webapp/WEB-INF/jsp/owners/createOrUpdateOwnerForm.jsp)|
165+
| JavaScript dependencies | [JavaScript libraries are declared as webjars in the pom.xml](pom.xml) |
166+
| Static resources config | [Resource mapping in Spring configuration](/src/main/resources/spring/mvc-core-config.xml#L30) |
167+
| Static resources usage | [htmlHeader.tag](src/main/webapp/WEB-INF/tags/htmlHeader.tag), [footer.tag](src/main/webapp/WEB-INF/tags/footer.tag) |
168+
| Thymeleaf | In the late 2016, the original [Spring Petclinic](https://github.com/spring-projects/spring-petclinic) has moved from JSP to Thymeleaf. |
169+
170+
| 'Service' and 'Repository' layers | Files |
171+
|-----------------------------------|-------|
172+
| Transactions | [business-config.xml](src/main/resources/spring/business-config.xml), [ClinicServiceImpl.java](src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java) |
173+
| Cache | [tools-config.xml](src/main/resources/spring/tools-config.xml), [ClinicServiceImpl.java](src/main/java/org/springframework/samples/petclinic/service/ClinicServiceImpl.java) |
174+
| Bean Profiles | [business-config.xml](src/main/resources/spring/business-config.xml), [ClinicServiceJdbcTests.java](src/test/java/org/springframework/samples/petclinic/service/ClinicServiceJdbcTests.java), [PetclinicInitializer.java](src/main/java/org/springframework/samples/petclinic/PetclinicInitializer.java) |
175+
| JDBC | [business-config.xml](src/main/resources/spring/business-config.xml), [jdbc folder](src/main/java/org/springframework/samples/petclinic/repository/jdbc) |
176+
| JPA | [business-config.xml](src/main/resources/spring/business-config.xml), [jpa folder](src/main/java/org/springframework/samples/petclinic/repository/jpa) |
177+
| Spring Data JPA | [business-config.xml](src/main/resources/spring/business-config.xml), [springdatajpa folder](src/main/java/org/springframework/samples/petclinic/repository/springdatajpa) |
178+
179+
180+
# Contributing
181+
182+
The [issue tracker](/issues) is the preferred channel for bug reports, features requests and submitting pull requests.
183+
184+
For pull requests, editor preferences are available in the [editor config](.editorconfig) for easy use in common text editors. Read more and download plugins at <http://editorconfig.org>.
185+
186+
In case you find a bug suggested improvement for Spring Petclinic for WebLogic
187+
188+
Our issue tracker is available here: https://github.com/oracle-samples/weblogic-examples/issues
189+
190+
# Attribution
191+
192+
This repo is a fork of the [spring-projects/spring-framework-petclinic](https://github.com/spring-projects/spring-framework-petclinic) example, licensed under the Apache License 2.0. [License](LICENSE.txt) for spring-framework-petclinic is included in this repository.
193+
194+
# Code Changes
195+
196+
The following code changes where introduced from `spring-framework-petclinic`:
197+
* Removed trimDirectiveWhitespaces="true" from tag files under [tag](src/main/webapp/WEB-INF/tags/)
198+
* [WebLogic descriptor](src/main/webapp/WEB-INF/weblogic.xml) added.
199+
* Removed jetty deployment descriptor
200+
* [JSTL Tag descriptor](src/main/webapp/WEB-INF/petclinic.tld) added.
201+
* Modified mvc-core-config.xml to include the handler servlet name
202+
<mvc:default-servlet-handler default-servlet-name="default">.
203+
* [Maven Pom](pom.xml)file modified to update dependencies.
204+
* mvnw wrapper removed.
205+
206+
207+
# License
208+
209+
Copyright (c) 2025 Oracle and/or its affiliates.
210+
211+
Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.
212+

0 commit comments

Comments
 (0)