Spring Annotation
- Anand Nerurkar
- Apr 30, 2024
- 1 min read
Updated: Jun 20, 2024
@SpringBootApplication
@EnableAutoConfiguration
@Configuration
@ComponenetScan
@configuration,
@Bean
This is being used for java based configuration and if you so not want spring ioc to manage life cycle , then make use of this.
By default, spring beans are eagerly loaded, so load it lazily, we make use of @Lazy
@ConfigurationProperties
@Value will retrieve data from application.propeties file. but if we want to retrieve it from other custom properties file, then we have to use @propertySource along with @Value
@pathvariable /v1/{id}
path variable is mandatory part of request in case id is missing 404 is issued-resource not found
@RequestPAram /v1/idbyparam?id=1 , id is optional ,so still your endpoint will work
Comments