Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create a mechanism to proxy non-spring managed objects for the new cache abstraction apis [SPR-8620] #13263

Closed
spring-issuemaster opened this issue Aug 17, 2011 · 3 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Aug 17, 2011

Travis Schneeberger opened SPR-8620 and commented

We have a usecase where we have services that in certain cases are spring-managed while in other cases are not and instantiated in code.

For example: We have a service interface like the following:

interface FooService {
@Cacheable(value="foos" key="#id")
Foo getFoo(String id);
}

Sometimes the implementation of this interface comes from Spring. Other times this implementation comes from org.apache.cxf.frontend.ClientProxyFactoryBean (or something similar) and is proxied (instantiated) directly in code.

The problem is, the caching proxies will only be created when the bean is spring managed. We would like the ability to Proxy an instance with a caching proxy on the fly, in code. For example:

ClientProxyFactoryBean clientFactory...
CacheManager cacheManager... //lookup the CacheManager

FooService fs = (FooService) clientFactory.create();
fs = CachedProxy.createCacheProxy(fs, cacheManager); //creates a Proxy with the caching logic based on the Spring annotations on the interface

I created something to do just this which I'll attach to the jira. One problem with my implementation is it uses package private Spring classes. It would be nice if the spring provided a mechanism to do this. If nothing else it would be good of some of the Spring caching code was opened up so that it could be accessed from other packages. Please feel free to use any parts of the attached code if you want.

My code is based on milestone 2. Thanks.


Affects: 3.1 M2

Attachments:

2 votes, 3 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Aug 19, 2011

Travis Schneeberger commented

Here is a unit test for my CacheProxy.java file.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Aug 25, 2011

Aaron Hamid commented

This would be handy +1

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 12, 2019

Bulk closing outdated, unresolved issues. Please, reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.