0
在Play 1插件基類,是play.PlayPlugin
,裏面有很多的方法(場):爲什麼Play 1和Play 2之間`plugin`的基類有如此不同?
index : int
onLoad()
compileSources()
runTest(Class<BaseTest>)
bind(String, Class, Type, Annotation[], Map<String, String[]>)
bind(RootParamNode, String, Class<?>, Type, Annotation[])
bind(String, Object, Map<String, String[]>)
bindBean(RootParamNode, String, Object)
unBind(Object, String)
getMessage(String, Object, Object...)
getStatus()
getJsonStatus()
enhance(ApplicationClass)
onTemplateCompilation(Template)
rawInvocation(Request, Response)
serveStatic(VirtualFile, Request, Response)
beforeDetectingChanges()
loadTemplate(VirtualFile)
detectChange()
detectClassesChange()
onApplicationStart()
afterApplicationStart()
onApplicationStop()
beforeInvocation()
afterInvocation()
onInvocationException(Throwable)
invocationFinally()
beforeActionInvocation(Method)
onActionInvocationResult(Result)
onInvocationSuccess()
onRequestRouting(Route)
afterActionInvocation()
onConfigurationRead()
onRoutesLoaded()
onEvent(String, Object)
onClassesChange(List<ApplicationClass>)
addTemplateExtensions()
addMimeTypes()
compileAll(List<ApplicationClass>)
routeRequest(Request)
modelFactory(Class<? extends Model>)
afterFixtureLoad()
postEvent(String, Object)
onApplicationReady()
compareTo(PlayPlugin)
overrideTemplateSource(BaseTemplate, String)
willBeValidated(Object)
和播放2的是play.api.Plugin
,這是非常簡單的:
onStart(): Unit
onStop(): Unit
enabled: Boolean
爲什麼他們如此不同?我認爲Play 1的插件類中的方法定義爲extension-points
,對於Play 2,它們不再需要嗎?