BadPractice - SpotBugsExtensionForSpringFrameWork/CS5098 GitHub Wiki
(probably) Fully understood and theorized Bug Patterns
- Use @Enumerated(EnumType.STRING) over @Enumerated(EnumType.ORDINAL) @YooChul #JPA @YC :dog:
- Do not define destruction method on the beans with prototype scope @YooChul @YC :dog:
- Custom Exception Using Try-Catch Block @Zhuoyang @ZL
- When we use @Autowired on a setter method in an abstract class, we should use the final keyword. @YooChul @YC :dog:
- Use @Resource over @Autowire + @Qualifier for collection type injection (to shorten your code). @YooChul @YC :dog:
- Use ResponseStatusException over @ResponseStatus #MVC @YooChul @YC :dog:
- Should use
AsyncResult<V>
return type to handle @Async exception instead ofFuture<V>
return type @Zhuoyang @ZL - Proper exception handler with @Async method
void
return type @YooChul @ZL - Use @PreDestroy and @PostConstruct over InitializingBean and DisposableBean @YooChul @YC
Waiting List for theorization
- Injected Value To Static Fields @Zhuoyang
- Used @Autowired With Static Fields @Zhuoyang
- Try not to hardcode the value in @Value, since it causes a recompile process to change the value. @YooChul
- in progress
Not sure to use
- Use ApplicationContext over BeanFactory #SpringCore @YooChul reason: One might need only the function of BeanFactory.
- Avoid using ApplicationContextAware interface @YooChul
- Avoid accessing FactoryBean directly and invoking its getObject() manually, and let Spring do it for you @YooChul