File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed
spring-boot-xml/naive-spring-boot Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ <h1 >Sample java spring boot with xml</h1 >
2+ <p >This project is a Spring Boot application that serves a simple REST API endpoint returning XML responses.</p >
3+
4+ <h2 >How to Run</h2 >
5+ <p >Ensure you have Java 17 installed. Then, follow these steps:</p >
6+ <ol >
7+ <li >Clone the repository </li >
8+ <li >Navigate into the project directory</li >
9+ <li >Build the project: <code >mvn clean install</code ></li >
10+ <li >Run the application: <code >mvn spring-boot:run</code ></li >
11+ </ol >
12+
13+ <h2 >API Endpoints</h2 >
14+ <h3 >Get User (Returns XML)</h3 >
15+ <p >Endpoint: <code >GET /api/user</code ></p >
16+
17+ <h3 >Testing with Curl</h3 >
18+ <p >To make a request using <code >curl</code >, use the following command:</p >
19+ <pre >
20+ <code >curl -X GET -H "Accept: application/xml" http://localhost:8080/api/user</code >
21+ </pre >
22+
23+ <h2 >Expected XML Response</h2 >
24+ <pre >
25+ <code >
26+ < ; User> ;
27+ < ; name> ; John Doe< ; /name> ;
28+ < ; age> ; 30< ; /age> ;
29+ < ; phone> ; 0101233333< ; /phone> ;
30+ < ; /User> ;
31+ </code >
32+ </pre >
33+
34+ <h2 >Dependencies</h2 >
35+ <ul >
36+ <li >Spring Boot</li >
37+ <li >Spring Web</li >
38+ <li >JAXB for XML serialization</li >
39+ </ul >
You can’t perform that action at this time.
0 commit comments