ggeorgovassilis / spring-rest-invoker

Spring invoker which maps remote REST services to local interfaces.
Apache License 2.0
37 stars 19 forks source link

Explicit proxy creation #33

Closed akaigoro closed 6 years ago

akaigoro commented 6 years ago

Provide example how to create proxy object manually without xml configuration, and ideally, without using Spring at all. One possible application for this is creating integration tests against controllers of a web application, where the test suite does not use xml configuration files and tries to minimize the number of spring beans in order to run the tests faster.

ggeorgovassilis commented 6 years ago

@akaigoro please document the motivation for this ticket; off the top of my hat I don't see a use case for either.

ggeorgovassilis commented 6 years ago

Closed for lack of activity

akaigoro commented 6 years ago

did you notice my update to description, where I explained the motivation for this ticket?

ggeorgovassilis commented 6 years ago

@akaigoro I did not. I'll look into providing an example without XML, but I don't see how any of it could work without spring.

ggeorgovassilis commented 6 years ago

@akaigoro please have a look at https://github.com/ggeorgovassilis/spring-rest-invoker/commit/b6df5fce4af44e5b05f70e9de5ea07c4c1805fcb

akaigoro commented 6 years ago

thanks, but this solution is too complicated for me. For example, there is @Resource(name="BankService") private BankService bankService; but the method @Bean SpringRestInvokerProxyFactoryBean BankService() {} returns SpringRestInvokerProxyFactoryBean and not BankService. So I will not recommend my manager to use your library. Thanks again.

ggeorgovassilis commented 6 years ago

@akaigoro that's how factory beans work. You create a factory and that one creates the objects. This is transparent: the unit test (which I linked to earlier) uses BankService beans even though the configuration produces factory beans. You can read more here: https://www.baeldung.com/spring-factorybean

I, too, would recommend against using spring-rest-invoker for your projects because they don't seem to use Spring. You may want to look at RESTEasy https://resteasy.github.io/