Ankeet's backend garden


  • tenets of Spring boot

    • dependency management
    • auto-configuration
    • simple deployment - I know k8 and docker, heh
  • main annotations

  • [[REST]] is the way stuff works now

  • #spring bean - is something that's created by Spring and its lifecycle is managed from within the Spring framework - user never specifies it's creation or GC #confirm

  • wow you can create an api by just doing this

class ProductService {
private List<Product> products = new ArrayList<Product>();
public ProductService() {
new Product("1", "potato"),
new Product("2", "onions"),
new Product("3", "chips"),
new Product("4", "fruits")
@GetMapping(value = "/products")
Iterable<Product> getProducts() {
return products;
  • you can use Optional<type> as the return param for an api if the value can be empty
@GetMapping(value = "/products/{id}")
Optional<Product> getProductById(@PathVariable String id) {
for(Product p: products) {
if(p.getId() == id) return Optional.of(p);
return Optional.empty();


ways we can environmentify the application

  • by default is present in the maven flavoured codebase
  • can be used using @Value with some expression language to get the value

an example showing reading value from

class ConfigParamsController {
private String environment;
String getEnvironment() {
return environment;