Skip to content

Commit b618ee8

Browse files
SpringBootJerseyExample
1 parent 99543e2 commit b618ee8

File tree

12 files changed

+817
-0
lines changed

12 files changed

+817
-0
lines changed

SpringBootJerseyExample/doc/help.txt

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
to build the jar file
2+
-------------------------
3+
> mvn package
4+
5+
To Execute the Application
6+
---------------------------
7+
>mvn spring-boot:run
8+
9+
To get the output
10+
==============================================================
11+
url => http://localhost:8080/application/message
12+
Accept:application/json
13+
{
14+
"message": "Hello adarsh kumar null",
15+
"httpStatus": "200"
16+
}
17+
18+
Accept:application/xml
19+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
20+
<responseBean>
21+
<httpStatus>200</httpStatus>
22+
<message>Hello adarsh kumar null</message>
23+
</responseBean>
24+
==============================================================
25+
url => http://localhost:8080/application/user/list
26+
Accept:application/xml
27+
28+
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
29+
<users>
30+
<user>
31+
<email>adarsh@kumar</email>
32+
<firstName>adarsh</firstName>
33+
<lastName>kumar</lastName>
34+
<userId>100</userId>
35+
</user>
36+
<user>
37+
<email>amit@kumar</email>
38+
<firstName>amit</firstName>
39+
<lastName>kumar</lastName>
40+
<userId>101</userId>
41+
</user>
42+
<user>
43+
<email>radha@singh</email>
44+
<firstName>radha</firstName>
45+
<lastName>singh</lastName>
46+
<userId>102</userId>
47+
</user>
48+
</users>
49+
50+
==============================================================
51+
url => http://localhost:8080/application/user/list
52+
Accept:application/json
53+
[
54+
{
55+
"userId": 100,
56+
"firstName": "adarsh",
57+
"lastName": "kumar",
58+
"email": "adarsh@kumar"
59+
},
60+
{
61+
"userId": 101,
62+
"firstName": "amit",
63+
"lastName": "kumar",
64+
"email": "amit@kumar"
65+
},
66+
{
67+
"userId": 102,
68+
"firstName": "radha",
69+
"lastName": "singh",
70+
"email": "radha@singh"
71+
}
72+
]
73+
74+
==============================================================
75+
url => http://localhost:8080/application/user/save
76+
Accept:application/json
77+
Content-Type:application/json
78+
input
79+
{
80+
"userId": 104,
81+
"firstName": "sonu",
82+
"lastName": "singh",
83+
"email": "sonu@singh"
84+
}
85+
output
86+
{
87+
"message": "User Saved ",
88+
"httpStatus": "200"
89+
}
90+
91+
Accept:application/xml
92+
Content-Type:application/xml
93+
<user>
94+
<email>sonu@singh</email>
95+
<firstName>sonu</firstName>
96+
<lastName>singh</lastName>
97+
<userId>104</userId>
98+
</user>
99+
==============================================================
100+
To exit from Execution
101+
--------------------------
102+
ctrl-c

SpringBootJerseyExample/pom.xml

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
5+
http://maven.apache.org/xsd/maven-4.0.0.xsd">
6+
7+
<modelVersion>4.0.0</modelVersion>
8+
9+
<groupId>SpringBootJerseyExample</groupId>
10+
<artifactId>SpringBootJerseyExample</artifactId>
11+
<version>1.0-SNAPSHOT</version>
12+
13+
<parent>
14+
<groupId>org.springframework.boot</groupId>
15+
<artifactId>spring-boot-starter-parent</artifactId>
16+
<version>1.3.1.RELEASE</version>
17+
</parent>
18+
19+
<organization>
20+
<name>ESpark</name>
21+
<url>http://adarshkumarsingh83.blogspot.in/</url>
22+
</organization>
23+
24+
<licenses>
25+
<license>
26+
<name>ESpark</name>
27+
<url>http://adarshkumarsingh83.blogspot.in/licenses/LICENSE-2.0.txt</url>
28+
<distribution>repo</distribution>
29+
</license>
30+
</licenses>
31+
32+
<developers>
33+
<developer>
34+
<id>adarshkumarsingh83</id>
35+
<name>Adarsh Kumar</name>
36+
<email>adarshkumarsingh83@gmail.com</email>
37+
<roles>
38+
<role>project architect</role>
39+
</roles>
40+
</developer>
41+
</developers>
42+
43+
<repositories>
44+
<repository>
45+
<id>maven2-repository.java.net</id>
46+
<name>Java.net Repository for Maven</name>
47+
<url>http://download.java.net/maven/2/</url>
48+
</repository>
49+
50+
<repository>
51+
<id>JBoss repository</id>
52+
<url>http://repository.jboss.org/nexus/content/groups/public/</url>
53+
</repository>
54+
55+
<repository>
56+
<id>java.net</id>
57+
<url>https://maven.java.net/content/repositories/public/</url>
58+
</repository>
59+
60+
</repositories>
61+
62+
<properties>
63+
<project.name>SpringBootJerseyExample</project.name>
64+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
65+
<java.version>1.7</java.version>
66+
<junit.version>4.11</junit.version>
67+
<slf4j.version>1.6.1</slf4j.version>
68+
<log4j.version>1.2.17</log4j.version>
69+
</properties>
70+
71+
<dependencies>
72+
73+
<dependency>
74+
<groupId>org.springframework.boot</groupId>
75+
<artifactId>spring-boot-starter-web</artifactId>
76+
<version>1.3.1.RELEASE</version>
77+
</dependency>
78+
79+
<dependency>
80+
<groupId>org.springframework.boot</groupId>
81+
<artifactId>spring-boot-starter-test</artifactId>
82+
<version>1.2.6.RELEASE</version>
83+
</dependency>
84+
85+
<dependency>
86+
<groupId>org.springframework.boot</groupId>
87+
<artifactId>spring-boot-starter-jersey</artifactId>
88+
<version>1.3.1.RELEASE</version>
89+
</dependency>
90+
91+
<dependency>
92+
<groupId>com.fasterxml.jackson.dataformat</groupId>
93+
<artifactId>jackson-dataformat-xml</artifactId>
94+
<version>2.7.0</version>
95+
</dependency>
96+
97+
<dependency>
98+
<groupId>junit</groupId>
99+
<artifactId>junit</artifactId>
100+
<version>${junit.version}</version>
101+
</dependency>
102+
103+
<dependency>
104+
<groupId>org.slf4j</groupId>
105+
<artifactId>slf4j-api</artifactId>
106+
<version>${slf4j.version}</version>
107+
</dependency>
108+
109+
<dependency>
110+
<groupId>log4j</groupId>
111+
<artifactId>log4j</artifactId>
112+
<version>${log4j.version}</version>
113+
</dependency>
114+
115+
</dependencies>
116+
117+
<build>
118+
<finalName>${project.name}</finalName>
119+
<outputDirectory>target/classes</outputDirectory>
120+
<resources>
121+
<resource>
122+
<directory>src/main/resources</directory>
123+
<filtering>true</filtering>
124+
</resource>
125+
</resources>
126+
<plugins>
127+
<plugin>
128+
<artifactId>maven-compiler-plugin</artifactId>
129+
<configuration>
130+
<source>${java.version}</source>
131+
<target>${java.version}</target>
132+
<encoding>${project.build.sourceEncoding}</encoding>
133+
</configuration>
134+
</plugin>
135+
136+
<plugin>
137+
<groupId>org.springframework.boot</groupId>
138+
<artifactId>spring-boot-maven-plugin</artifactId>
139+
</plugin>
140+
</plugins>
141+
</build>
142+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* Copyright (c) 2015 Espark And ©Adarsh Development Services @copyright All rights reserved.
3+
*
4+
* Redistribution and use in source and binary forms, with or without
5+
* modification, are permitted provided that the following conditions
6+
* are met:
7+
*
8+
* - Redistributions of source code must retain the above copyright
9+
* notice, this list of conditions and the following disclaimer.
10+
*
11+
* - Redistributions in binary form must reproduce the above copyright
12+
* notice, this list of conditions and the following disclaimer in the
13+
* documentation and/or other materials provided with the distribution.
14+
*
15+
* - Neither the name of Espark nor the names of its
16+
* contributors may be used to endorse or promote products derived
17+
* from this software without specific prior written permission.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
*/
31+
package com.espark.adarsh.bean;
32+
33+
import javax.xml.bind.annotation.XmlRootElement;
34+
import java.io.Serializable;
35+
36+
/**
37+
* @author Adarsh Kumar
38+
* @author $LastChangedBy: Adarsh Kumar$
39+
* @version $Revision: 0001 $, $Date:: 1/1/10 0:00 AM#$
40+
* @Espark @copyright all right reserve
41+
*/
42+
@XmlRootElement
43+
public class ResponseBean implements Serializable {
44+
45+
private String message;
46+
private String httpStatus;
47+
48+
public ResponseBean() {
49+
}
50+
51+
public ResponseBean(String message, String httpStatus) {
52+
this.message = message;
53+
this.httpStatus = httpStatus;
54+
}
55+
56+
public String getMessage() {
57+
return message;
58+
}
59+
60+
public void setMessage(String message) {
61+
this.message = message;
62+
}
63+
64+
public String getHttpStatus() {
65+
return httpStatus;
66+
}
67+
68+
public void setHttpStatus(String httpStatus) {
69+
this.httpStatus = httpStatus;
70+
}
71+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
2+
/*
3+
* Copyright (c) 2015 Espark And ©Adarsh Development Services @copyright All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions
7+
* are met:
8+
*
9+
* - Redistributions of source code must retain the above copyright
10+
* notice, this list of conditions and the following disclaimer.
11+
*
12+
* - Redistributions in binary form must reproduce the above copyright
13+
* notice, this list of conditions and the following disclaimer in the
14+
* documentation and/or other materials provided with the distribution.
15+
*
16+
* - Neither the name of Espark nor the names of its
17+
* contributors may be used to endorse or promote products derived
18+
* from this software without specific prior written permission.
19+
*
20+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21+
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22+
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23+
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24+
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25+
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26+
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27+
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29+
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*/
32+
package com.espark.adarsh.controller;
33+
34+
import com.espark.adarsh.bean.ResponseBean;
35+
import com.espark.adarsh.entity.User;
36+
37+
import java.util.List;
38+
39+
/**
40+
* @author Adarsh Kumar
41+
* @author $LastChangedBy: Adarsh Kumar$
42+
* @version $Revision: 0001 $, $Date:: 1/1/10 0:00 AM#$
43+
* @Espark @copyright all right reserve
44+
*/
45+
public interface ApplicationController {
46+
47+
public ResponseBean welcomeMessage();
48+
49+
public List<User> getUserData();
50+
51+
public ResponseBean saveUser(User user);
52+
}

0 commit comments

Comments
 (0)