2020 m. kovo 6 d., penktadienis

Spring boot

Guides: https://spring.io/guides
Spring initializer: https://start.spring.io/
Docs: https://docs.spring.io/
HttpStatus Status values

REST - Representational State Transfer
DAO - Data access object (ryšys su duombaze)
model?
JSON - Javascript Object Notation
POJOS - Plain Old Java Objects
JAR - Java Archive
ORM - Object relation mapping
ODBC - Object Database Connectivity
JDBC - Java Database Connectivity

@RestController = @Controller + @ResponseBody 
 
@Service or @Component or @Repository

Running with maven
$ mvn clean package
$ mvn spring-boot:run

$ mvn clean
$ mvn install #target direktorijoje atsiras .jar failiukas
Autowiring@Autowired




GET

@GetMapping
@RequestMapping(method = RequestMethod.GET)

@GetMapping(path="/hello")
@RequestMapping(method = RequestMethod.GET, path="/hello"))

@GetMapping(path="/{name}")
public String getName(@PathVariable String name)

POST

@PostMapping()
@RequestMapping(method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)


DELETE

@DeleteMapping(path = "/{username}")
@RequestMapping(path = "/{username}", method = RequestMethod.DELETE)
public void deleteUser(@PathVariable final String username) {}

application.properies

logging.level.org.springframework.web: DEBUG
logging.level.org.springframework: DEBUG
server.port=9090

spring.jackson.serialization.write-dates-as-timestamps=false





Links

Lombok in Eclipse.
Project auto refresh with devtools
Java validation annotations:
Jwt security