@DirtiesContext in Spring

@DirtiesContext is a test annotation which indicates that the  ApplicationContext associated with a test is dirty and should therefore be closed and removed from the context cache. Once the TestContext framework loads an  ApplicationContext  (or WebApplicationContext) for a test, that context is cached and reused for all subsequent tests that declare the same unique context configuration within the same test suite. For example, if TestClassA specifies {“app-config.xml”, “test-config.xml”} for the locations (or value) attribute of @ContextConfiguration, the … Continue reading @DirtiesContext in Spring

Intro to Spring Cloud Contract

Everyone is into micro services now a days. Deploying new services into today’s distributed system requires another level of confidence. Spring cloud contract provides support for Consumer Driven Contracts (CDC) and service schemas in Spring applications. It enables Consumer Driven Contract (CDC) development of spring applications and makes sure that the new feature(i.e. API) that we are going to add in our existing application, should … Continue reading Intro to Spring Cloud Contract

@ConfigurationProperties in Spring Boot

There are number of ways you can externalize your configuration properties in application so that you can work in different environment. You can use properties files, YAML files, environment variables, and command-line arguments to externalize configuration. Property values can be injected directly into your beans by using the @Valueannotation but that is very tedious and cumbersome process , especially if you are working with multiple … Continue reading @ConfigurationProperties in Spring Boot

Spring Profiles

Spring profile is a way to achieve environment specific execution of class or code i.e. Spring Profiles provide a way to segregate parts of your application configuration and make it be available only in certain environments.  If you want to run your piece of code or initialize any specific bean in any certain environment, Spring Profiles is the option. Implementation Any class marked with @Component … Continue reading Spring Profiles