Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

java-play2: api changes should recompile on browser refresh #32

Closed
seantbrady opened this Issue · 7 comments

3 participants

@seantbrady

This is an enhancement request. One of the big advantages of Play is recompilation of changed classes on browser refresh. The development cycle is extremely rapid. Unfortunately, it doesn't seem that changes to API annotations cause the supporting swagger classes to recompile on browser refresh. This means the app needs to be restarted to see API changes take effect.

Maybe someone from the Play team (@pk11) would be able to help.

@fehguy
Owner

I agree, something with the reload mechanism is missing a cached object. Will investigate...

@seantbrady

Brute forcing it works for now:

I added a reset() method to ApiHelpInventory and then call it from Global.onStart(...)

ApiHelpInventory
def reset = {
controllerClasses.clear
resourceMap.clear
}

Global
onstart(...) {
ApiHelpInventory.reset();
}

@ayush

@seantbrady That seems like a reasonable workaround, although we probably need a reset method in PlayApiReader too.

In play2 the compilation is handled by SBT so other than your Global.onStart approach (or writing a sbt plugin?!) I'm not sure whats the hook swagger-play2 can tap into to expire that cache. In play1 there are hooks which get called back when classes change.

@ayush

@seantbrady This commit should address this. Please reopen with more details if you encounter problems with it.

@ayush ayush closed this
@fehguy
Owner

thanks @ayush!

@ayush ayush reopened this
@ayush

still fixing. some loose ends on this.

@ayush

ok, try now.

@ayush ayush closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.