Commit Graph

19 Commits

Author SHA1 Message Date
Mehmet Mustafa Yilmaz
ce15b8e580 fix: Guice Cannot Inject Beans with Custom Annotations
SpringModule binds custom guice Providers for Spring managed beans so that Guice can inject beans from Spring Context.
Due to a bug in the Provider, Guice can only inject Spring beans that either don't have any qualifier annotations or only have Named annotation as a qualifier.

This fix enables Guice to inject beans with custom qualifier annotations as well.
Custom qualifier annotations do not need to be marker annotations (in other words, they can have attributes).

Other changes include:
Using factory method metadata of annotated bean definition rather than using custom code to retrieve factory method and its annotations

Added more test cases to validate various qualifier annotation scenarios.
2023-01-06 07:36:20 +00:00
Dave Syer
e71d6aca56 Use static factory methods and proxyBeanMethods = false
It is better to be explicit about beans of type `Module` and make
sure they don't interfere with Spring trying to enhance
`@Configuration` classes. The tests are now clear of the pesky
warning logs, and there is a new section in the README.
2022-03-21 08:41:05 +00:00
Simon DeMartini
2722841925 Convert JUnit assertions to AssertJ to match spring-javaformat checkstyle rules 2022-03-20 16:29:28 +00:00
Simon DeMartini
99d7a7a268 Upgrade to JUnit 5 2022-03-20 16:29:28 +00:00
Simon DeMartini
57c54fad2f Add and enforce spring checkstyle configurations 2022-03-20 10:40:10 +00:00
Simon DeMartini
7254dc8be7 Apply and enforce spring-javaformat 2022-03-19 21:15:20 +00:00
Howard Yuan
e54c544afa Add more logic to the test 2021-04-20 07:06:05 +01:00
Howard Yuan
c6b5fd89f6 Add Unit Test for lazy init Guice providers 2021-04-20 07:06:05 +01:00
Spring Operator
3650197554 URL Cleanup
This commit updates URLs to prefer the https protocol. Redirects are not followed to avoid accidentally expanding intentionally shortened URLs (i.e. if using a URL shortener).

# Fixed URLs

## Fixed Success
These URLs were switched to an https URL with a 2xx status. While the status was successful, your review is still recommended.

* [ ] http://www.apache.org/licenses/LICENSE-2.0 with 25 occurrences migrated to:
  https://www.apache.org/licenses/LICENSE-2.0 ([https](https://www.apache.org/licenses/LICENSE-2.0) result 200).
2019-03-27 15:32:41 +00:00
Dave Syer
fd835487d3 Ensure *Aware contracts can be satisfied in ModuleRegistryConfiguration
If the BeanFactoryProvider is used there is a partially refreshed
ApplicationContext floating around. It works better if it is able to
inject Environment etc. via the Aware interfaces into early beans
like post processors.
2019-01-10 09:21:51 +00:00
Dave Syer
af2497c6d8 Polish 2019-01-10 09:21:24 +00:00
Dave Syer
490fc20cf7 Extract BeanFactoryProvider into convenience class 2017-06-01 11:12:54 +01:00
Dave Syer
a01511f269 Add Maven wrapper 2017-06-01 11:12:54 +01:00
Taylor Wicksell
b26bdb4125 Make SpringModule aware of bindings in wrapping Injector
See gh-13, gh-12
2017-06-01 11:12:32 +01:00
Taylor Wicksell
061aef36f2 support binding of generic interfaces from SpringModule 2017-06-01 08:32:23 +01:00
Dave Syer
5708ba0469 Add test for spring module including another guice module
This test is from a PR by @twicksell, but modified to run without
any changes in spring-guice. See gh-12 for discussion.
2017-05-24 17:40:03 +01:00
Dave Syer
771edd3711 Add support for @Named beans in SpringModule
A SpringModule now registers all beans by type and by name
separately, so clients can inject qualified instances.
2017-05-21 13:29:51 +01:00
Dave Syer
1002284360 Add support for bean names
Users can in inject Spring beans by name in Guice using
@Named, or they can inject Guice beans in Spring as long
as they have @Named providers.

Fixes gh-7
2016-06-02 10:25:32 +01:00
Dave Syer
2698b4e3e3 Add some sub-packages 2014-04-22 11:38:20 +01:00