spring-projects / spring-projects/spring-framework
Setting order programmatically on OncePerRequestFilter or HandlerExceptionResolver beans using BeanRegistrar or GenericApplicationContext does not work
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 60.2k
- Forks
- 38.8k
- Avg merge
- 5d 2h
- Merged PRs (30d)
- 27
Description
If you annotate your OncePerRequestFilter or HandlerExceptionResolver beans with @Order annotation that is registered programmatically using BeanRegistrar or GenericApplicationContext, it works correctly. Order value provided in @Order annotation influences order of filter or resolver.
However if you instead provide order value in registerBean's order parameter in case of BeanRegistrar or if you set AbstractBeanDefinition.ORDER_ATTRIBUTE in case of GenericApplicationContext , this value has no influence on filter or resolver order.
SpringBoot 4.0.3
JDK 25
Kotlin 2.3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the behavior with OncePerRequestFilter and HandlerExceptionResolver beans registered through BeanRegistrar and GenericApplicationContext, comparing @Order with the registerBean order parameter and AbstractBeanDefinition.ORDER_ATTRIBUTE. Trace how the registered order is read when filters and resolvers are assembled; done means both programmatic order mechanisms affect the resulting order consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100