Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
spring-basic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
정 의찬
spring-basic
Commits
4d453bc6
Commit
4d453bc6
authored
1 month ago
by
정 의찬
Browse files
Options
Downloads
Patches
Plain Diff
RestController parameter test
parent
a8de9a6d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/com/example/demo/DemoApplication.java
+0
-5
0 additions, 5 deletions
src/main/java/com/example/demo/DemoApplication.java
src/main/java/com/example/demo/controller/TestController.java
+12
-6
12 additions, 6 deletions
...main/java/com/example/demo/controller/TestController.java
with
12 additions
and
11 deletions
src/main/java/com/example/demo/DemoApplication.java
+
0
−
5
View file @
4d453bc6
...
...
@@ -13,9 +13,4 @@ public class DemoApplication {
SpringApplication
.
run
(
DemoApplication
.
class
,
args
);
}
@GetMapping
(
value
=
"/"
)
public
String
HelloWorld
(){
return
"Hello World"
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/com/example/demo/controller/TestController.java
+
12
−
6
View file @
4d453bc6
...
...
@@ -5,18 +5,24 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.google.gson.JsonObject
;
@RestController
public
class
TestController
{
@GetMapping
(
value
=
"/test"
)
public
UserDto
test
()
{
@RequestMapping
(
value
=
"/"
,
method
=
RequestMethod
.
GET
)
public
String
test
(
@RequestParam
(
"id"
)
String
id
){
JsonObject
obj
=
new
JsonObject
();
obj
.
addProperty
(
"title"
,
"산사와 아가싸"
);
obj
.
addProperty
(
"content"
,
"로맨틱 코메디"
);
UserDto
dto
=
new
UserDto
();
d
to
.
setAge
(
17
);
dto
.
setName
(
"Jane"
);
JsonObject
data
=
new
JsonObject
();
d
ata
.
addProperty
(
"time"
,
"토일 8시"
);
obj
.
add
(
"data"
,
data
);
return
dto
;
return
obj
.
toString
()
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment