β˜€οΈ
Dev7Days
  • πŸ˜„Welcome
  • Local Setup
    • βš™οΈSetup Terminal
    • βš™οΈSetup IDE
    • βš™οΈSetup Neovim
  • Rust
    • πŸ¦€Cargo
  • Java
    • πŸƒSpring Boot
      • Spring Boot Annotaion
      • Spring Boot Learning
    • πŸƒJDK vs JRE vs JVM
    • πŸƒWhat is JDBC ?
    • πŸƒWhat is Data Source in Java ?
    • πŸƒCheck vs Unchecked Exception
    • πŸƒWhat is Servlet in Java ?
    • πŸƒFilter vs Interceptor
    • πŸƒMockito
    • πŸƒMaven CLI
    • πŸƒMaven Archetype
  • Go
    • πŸ”ΉGo Routine and Channel
    • πŸ”ΉGo CLI
  • Ruby and Rails
    • ♦️Ruby Syntax
    • ♦️Rails Framework
    • ♦️Rails Structure
  • Fundamental
    • πŸ“šGit Command
    • πŸ“šInterpreter vs Compiler
    • πŸ“šDTO vs DAO
    • πŸ“šHttp Status
    • πŸ“šWhat is Batch Process ?
    • πŸ“šHttps
    • πŸ“šLocal Storage vs Session Storage vs Cookies
    • πŸ“šAuthentication & Authorization
    • πŸ“šDatabase Index
    • πŸ“šWhat is GRPC ?
    • πŸ“šWhat is Microservice ?
  • Database
    • πŸ—ƒοΈWhat is Transaction ?
    • πŸ—ƒοΈACID
  • Postgres
    • 🐘SELECT
    • 🐘Column Alias
    • 🐘Order By
    • 🐘SELECT DISTINCT
  • Elastic Search
    • πŸ”What is Elastic Search ?
    • πŸ”Node and Cluster
  • Kubernetes
    • ☸️What is Kubernetes ?
    • ☸️Kubernetes Architecture
      • Node
      • ETCD
      • Kube API Server
      • Controller Manager
      • Kube Scheduler
      • Kubelet
      • Kube Proxy
  • ☸️Pod
  • ☸️ReplicaSet
  • ☸️Deployment
  • ☸️Service
  • ☸️Config Map
  • ☸️Namespaces
  • ☸️Kube Apply Command
  • ☸️Scheduling
    • Manual Scheduling
    • Labels and Selectors
    • Taints and Tolerations
    • Node Selector
    • Node Affinity
    • Resource Requirements and Limits
    • DaemonSets
    • Static Pods
    • MultipleSchedulers
  • ☸️Monitoring
  • AWS
    • πŸ”ΈHow can users access AWS ?
    • πŸ”ΈIAM
    • πŸ”ΈEC2
      • User Data
      • Instance Types
      • Security Group
      • Purchasing Options
      • Placement Groups
      • Elastic Network Interface (ENI)
      • EC2 Hibernate
      • EC2 Storage
    • πŸ”ΈELB & ASG
      • Health Checks
      • Target Group
      • ELB Types
      • Sticky Sessions
      • Cross Zone Load Balancing
      • Load Balancer - SSL and SNI
      • Deregistration Delay
      • ASG
    • πŸ”ΈRDS & Aurora DB
      • RDS
        • Storage Auto Scaling
        • Read Replica
        • Multi AZ
        • RDS Custom
        • Backup
        • RDS Proxy
      • AWS Aurora
        • Read Replica
        • Endpoint and Auto Scaling
        • Aurora Serverless
        • Global Database
        • Machine Learning
        • Backup
        • Database Cloning
      • RDS & Aurora Restore options
      • RDS & Aurora Security
    • πŸ”ΈElastic Cache
    • πŸ”ΈRoute 53
      • Records
      • Hosted Zones
      • Health Check
      • Routing Policies
  • Backend Security
    • 🎩SQL Injection
    • 🎩Cross site script (XSS)
    • 🎩Cross site request forgery (CSRF)
    • 🎩Man in the Middle (MITM)
    • 🎩Insecure Direct Object Reference (IDOR)
    • 🎩Distributed denial of service (DDOS)
  • Medium
    • πŸ‘¨β€πŸ’»Gamer to Coder
    • 🐳Docker
      • Docker #1
      • Docker #2
    • πŸ’ŠDI and IOC
    • ☸️Kubernetes
  • Book
    • πŸ“šSystem Design Interview - An Insider's Guide (Volume 1
Powered by GitBook
On this page
  1. Java
  2. Spring Boot

Spring Boot Learning

Q&A about Spring boot

PreviousSpring Boot AnnotaionNextJDK vs JRE vs JVM

Last updated 11 months ago

  1. What is the difference between bootstrap.properties and application.properties ? Ans: In spring boot it will has 2 context that will be created before the application start the first is bootstrap context and the second context is application context. Boostrap context is parent of application context that will be created before. The difference of this 2 context, bootstrap context will run before application start so we use bootstrap.properties to load configuration from external source such as spring cloud.

  2. What is the difference between @Controller and @RestController ? Ans: @Controller is used in Spring for Web MVC to determine controller class. @RestController is similar to @Controller but it will be used for Rest webservice. @RestController = @Controller + @RespBody

  3. What is the difference between @Valid and @Validated ? Ans: @Valid is used on the method and it's not support for group level.@Validated is used on the class and support for group level futhermore When you need to validate with List type , you must use @Validated on the controller class and @Valid inside the method.

  4. What is the difference between create object by new Object() or @Builder(builder pattern) ? Ans: Create object with @Builder the object will be immutable so it can't have race condition for multi-thread process but create object by new Object() ,the attribute value can update by setter method.

  5. What is the difference between Logback and Log4j ? Ans: Log4j is a utility for logging in java that already deprecated. For now it has Log4j2 or Sl4j instead but Logback is a framework that consolidate all of this utilities.

  6. What is the diifference between @Autowired via field injection or constructor injection ? Ans: Field injection won't create instance of dependency immediately when create bean but constructor injection will create it immediately and more thread safe (because it is able to use final) than field injection. For implementaion of constructor injection when you have more than 1 constructor , you need to add @Autowired on constructor. Ref:

  7. What is the diifference between JdbcTemplate update() vs execute() ? Ans: execute() always use for managing database such as create table because it returns void but update() will use for DML because it returns number of record that will be updated.

πŸƒ
https://stackoverflow.com/questions/40620000/spring-autowire-on-properties-vs-constructor