https://github.com/rosyid-grobogan/spring-workout-1
Master Java Web Services and REST API with Spring Boot
https://github.com/rosyid-grobogan/spring-workout-1
restful-webservices spring spring-boot
Last synced: 2 months ago
JSON representation
Master Java Web Services and REST API with Spring Boot
- Host: GitHub
- URL: https://github.com/rosyid-grobogan/spring-workout-1
- Owner: rosyid-grobogan
- Created: 2020-03-29T02:48:55.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-08-26T18:02:04.000Z (almost 2 years ago)
- Last Synced: 2025-01-05T01:26:07.043Z (over 1 year ago)
- Topics: restful-webservices, spring, spring-boot
- Language: Java
- Size: 67.4 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Workout for Master Java Web Services and REST API with Spring Boot
## RESTful Web Services
## Social Media Application Resource Mapprings
## User -> Posts
* Retrieve all Users - GET /users
* Create a User - POST /users
* Retrieve one Users - GET /users/{id} -> /users/5
* Delete a User - DELETE /users/{id} -> /users/5
## Exercise User Post Resource and Exception Handling
* Retrieve all posts for a User - GET /users/{id}/posts
* Create a posts for a User - POST /users/{id}/posts
* Retrieve details of a post - GET /users/{id}/posts/{post_id}
## Error in the Log
```
Resolved exception caused by Handler execution:
```
## Internationalization
### Configuration
- LocaleResolver
- Default Locale - Locale.US
- ResourceBundleMessageSource
### Usage
- Autowire MessageSource
- @RequestHeader(value = "Accept-Language, required = false) Locale locale
- messageSource.getMessage("helloWorld.message", null, locale)
## Application.properties
```
logging.level.org.springframework = info
#This is not really needed as this is the default after 2.0.0.RELEASE
spring.jackson.serialization.write-dates-as-timestamps=false
spring.messages.basename=messages
management.endpoints.web.exposure.include=*
spring.security.user.name=username
spring.security.user.password=password
spring.jpa.show-sql=true
spring.h2.console.enabled=true
```
## Addtion for Dependencies in pom.xml
```
org.springframework.boot
spring-boot-starter-hateoas
com.fasterxml.jackson.dataformat
jackson-dataformat-xml
org.springframework.boot
spring-boot-starter-actuator
org.springframework.data
spring-data-rest-hal-browser
io.springfox
springfox-swagger2
2.4.0
io.springfox
springfox-swagger-ui
2.4.0
org.springframework.boot
spring-boot-devtools
runtime
com.h2database
h2
runtime
```
## Swagger
### Document API
```
localhost:8080/v2/api-docs
```
### Swagger UI
```
localhost:8080/swagger-ui.html
```