Memorynotfound Java Programming Tutorials
Find User Home Directory in Java
The System class maintains a Properties object that describes the configuration of the current working environment. Within these properties there exists one that identifies the users home directory. In most scenarios this will work,...
GSON Versioning Support with @Since Annotation
GSON introduced the @Since annotation to support multiple versions of the same object. We can use this annotation on Classes and Fields. In order to enable this feature we need to register a version...
Spring Filter Components From Component Scanning
When using auto component scanning, only the special marker interfaces and annotations that itself are annotated with @Component are eligible. We can modify and/or extend this behavior by applying custom filters. We can use...
Automatically Discover Beans with Auto Component Scanning
You can define your spring beans manually or let spring automatically discover stereotyped classes and register corresponding bean definitions with the application context. Spring scans for special marker annotations, which allows spring to auto-detect...
Creating and Configuring Custom @Qualifier Annotation
When Handling Multiple Dependencies with @Primary or Handling Multiple Dependencies with @Qualifier are not sufficient or you want to create your own custom @Qualifier Annotations for some reason. Spring allows you to create your...
Handling Multiple Autowire Candidates with Spring @Qualifier
Handling multiple autowire candidates with @Primary is effective when only one primary candidate can be determined for multiple autowire candidates. When you need more control over the selection process, you can use spring @Qualifier...
Handling Multiple Autowire Candidates with Spring @Primary
In spring, dependency injection is done default by type, this means that when there are multiple dependencies with the same type a NoUniqueBeanDefinitionException exception will be thrown. Indicating that only one candidate can be...
Spring Lifecycle Default Initialization and Destroy Methods
When working on a project with many team members, it is good to have some conventions. One of this conventions could be that you agree to use the same method name for initialization and...
Spring Lifecycle @PostConstruct and @PreDestroy annotations
The @PostConstruct and @PreDestroy are standard Java JSR-250 lifecycle annotations. Spring supports these annotations using the CommonAnnotationBeanPostProcessor. By annotation void no-argument signature methods with these annotations, your methods are eligible for initialization and destruction...