app-context is placed in conf path
public class SpringContextModule extends AbstractModule {
@Override
protected void configure() {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("app-context.xml");
bind(BeanFactory.class).toInstance(applicationContext);
}
}
and for this Module doesn't in root(app/) path , add it in application.conf
play.modules {
# By default, Play will load any class called service.core.PersistRawModuletRawModule that is defined
# in the root package (the "app" directory), or you can define them
# explicitly below.
# If there are any built-in modules that you want to disable, you can list them here.
#enabled += my.application.service.core.PersistRawModuletRawModule
enabled += "service.core.PersistRawModule"
enabled += "service.core.PersistModule"
enabled += "service.core.SpringContextModule"
# If there are any built-in modules that you want to disable, you can list them here.
#disabled += ""
}
finally , use spring context
public class UserAuthenticationHTTPBasicImp extends SupperEntityWithObjevtPersist<User>implements UserAuthenticationService {
private BeanFactory beanFactory;
private TokenService tokenService;
@Inject
public void setup(BeanFactory beanFactory,TokenService tokenService) {
this.tokenService = tokenService;
this.beanFactory = beanFactory;
}
I only use JMSTemplate with spring , so I placed this beanfactory at here . you could use it as normal Spring applications.
在 2016年5月29日星期日 UTC+8上午12:53:57,Santhosh Kumar写道: