Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
javab_20230617
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Patryk Czarnik
javab_20230617
Commits
ead6c5db
Commit
ead6c5db
authored
Aug 19, 2023
by
Patryk Czarnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Odczyt RESTowy
parent
3fdb3c9e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
RCustomers.java
...ataH2/src/main/java/com/example/demo/rest/RCustomers.java
+27
-0
No files found.
PC51-SpringDataH2/src/main/java/com/example/demo/rest/RCustomers.java
0 → 100644
View file @
ead6c5db
package
com
.
example
.
demo
.
rest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.example.demo.model.Customer
;
import
com.example.demo.repo.CustomerRepository
;
@RestController
@RequestMapping
(
path
=
"/rest/customers"
,
produces
=
"application/json"
)
public
class
RCustomers
{
@Autowired
private
CustomerRepository
customerRepository
;
@GetMapping
public
Iterable
<
Customer
>
readAll
()
{
return
customerRepository
.
findAll
();
}
@GetMapping
(
"/{id}"
)
public
Customer
readOne
(
@PathVariable
(
"id"
)
long
id
)
{
return
customerRepository
.
findById
(
id
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment