@Configuration
: Tags the class as a source of bean definitions for the application context.@EnableMongoRepositories
-- scans the current package for any interfaces that extend one of Spring Data’s repository interfaces. You can use its basePackageClasses=MyRepository.class
to safely tell Spring Data MongoDB to scan a different root package by type if your project layout has multiple projects and it does not find your repositories.@Bean
annotation indicates that the annotated method produces a bean to be managed by the Spring container. It is a direct analog of the <bean/>
XML tag. @Bean
supports most of the attributes offered by <bean/>
, such as: init-method
, destroy-method
, autowiring
, lazy-init
, dependency-check
, depends-on
, scope
-->
Configuration classes can contain bean definition methods annotated with @Bean.Bean
is a method-level annotation and a direct analog of the XML <bean/>
element. The annotation supports most of the attributes offered by <bean/>
-->
@Bean Annotation is applied on a method to specify that it returns a bean to be managed by Spring context. Spring Bean annotation is usually declared in Configuration classes methods. In this case, bean methods may reference other @Bean methods in the same class by calling them directly.@Slf4j
@Controller
@RequestMapping
@Autowired@PostMapping(value = "/hotelDumpFromFile")@ApiOperation@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully ingested Expedia Rapid HotelDetails "),
@ApiResponse(code = 500, message = "Unable to ingested Expedia Rapid HotelDetails")
})@Slf4j
@Service@Data
@Configuration@Value("${spring.profiles.active}")
@PostConstruct@Component@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder@JsonProperty("customerSessionId")
@Repository@Builder
@Getter
@Setter
@EqualsAndHashCode(exclude = "updateDate")
@ToString
@JsonInclude(JsonInclude.Include.NON_NULL)
@Document(collection = "staticDumpHotel")@Id
private String id;
private String hotelDetailId;
@Indexed@TolerateSimply put, @ApiParam and @ApiModelProperty annotations add different metadata to Swagger. The @ApiParam annotation is for the parameters of an API resource request, whereas @ApiModelProperty is for properties of the model.e @ApiParam annotation is for use solely with the JAX-RS 1.x/2.x parameter annotations like @PathParam, @QueryParam, @HeaderParam, @FormParam, and @BeanParam. Although swagger-core scans these annotations by default, we can use @ApiParam to add more details about the parameters or change the values as they are read from the code.
The @ApiParam annotation helps to specify the name, type, description (value), and example value of the parameter. Moreover, we can specify whether the parameter is required or optional.
The @ApiModelProperty annotation allows us to control Swagger-specific definitions such as description (value), name, data type, example values, and allowed values for the model properties.
Also, it offers additional filtering properties in case we want to hide the property in certain scenarios.
No comments:
Post a Comment