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

Scalext and Spring #7

Open
eoliphan opened this issue Aug 1, 2013 · 5 comments
Open

Scalext and Spring #7

eoliphan opened this issue Aug 1, 2013 · 5 comments

Comments

@eoliphan
Copy link

eoliphan commented Aug 1, 2013

Hi again, I'm using the spring framework as well in my app, and have realized that It may be difficult to have a Scalext @Remotable class/method also say get @Autowired correctly by spring. I'm using the apporach of creating a Global in play, and overriding getControllerInstance. I poked around in the code and you're of course doing a direct loadClass().

I'm thinking about doing some forking and hacking, but before I start do you have any suggestions in terms of an approach? I haven't had to do it in while, but I think one 'quick and dirty' approach would be to use Spring's load time weaving option, but this seems messier than I'd like lol

@Rovak
Copy link
Owner

Rovak commented Aug 1, 2013

I have no experience with Spring but the solution should be framework independent. Creating something similar as getControllerInstance looks like the best option.

My suggestion would be to create a trait which you can apply to the Global object. Whenever a class has to be loaded with the ApiFactory then it first checks if the trait is applied to the Global object, if not then fallback to the default classloader.

trait ScalextApiFactory {
  def loadApiClass(className: String): Class[_]
}

object Global extends GlobalSettings with ScalextApiFactory {
  def loadApiClass(className: String) = {
    // Custom classloader with optional dependency injection, @Autowire, etc...
  }
}

I have no idea if this is possible with Spring or the load time weaving option, would this work with your project?

@eoliphan
Copy link
Author

eoliphan commented Aug 4, 2013

SOmething like this might work, I'm going to play around with it and see.

@Rovak
Copy link
Owner

Rovak commented Aug 12, 2013

Any news on this or anything i can do to help?

@eoliphan
Copy link
Author

Not yet, I actually went with the javascript routes for the time being, on
a time crunch, but I'm going to revisit it as soon as I'm done, probably
next week some time

On Mon, Aug 12, 2013 at 3:00 PM, Roy van Kaathoven <[email protected]

wrote:

Any news on this or anyhing i can do to help?


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-22516579
.

Erich Oliphant

"There are, in fact, two things, science and opinion, the former begets
knowledge, the latter ignorance"
-- Hippocrates of Cos

@Rovak
Copy link
Owner

Rovak commented Aug 13, 2013

I'm gonna work on a Google Guice implementation using this Guice Module, i think it should also work with Spring with only a few modifications.

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

No branches or pull requests

2 participants