****Creating spring root web container with ContextLoaderListener
<!-- Responsible for instantiating spring root web application context container -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
@Override
//@WebMethod(exclude=true)
public String addProgram(ProgramVO addProgramInput) {
if(iProgramService==null) {
//Accessing Spring Root Web Container
ApplicationContext pplicationContext=ContextLoader.getCurrentWebApplicationContext();
iProgramService =(IProgramService)applicationContext.getBean("ProgramService");
}
com.gps.quiz.service.model.ProgramVO programVO=new com.gps.quiz.service.model.ProgramVO();
BeanUtils.copyProperties(addProgramInput, programVO, new String[]{"timestamp"});
programVO.setTimestamp(DateUtils.getCurrentTimeIntoTimestamp());
String result=iProgramService.addTempProgram(programVO);
return result;
}
<!-- Responsible for instantiating spring root web application context container -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
@Override
//@WebMethod(exclude=true)
public String addProgram(ProgramVO addProgramInput) {
if(iProgramService==null) {
//Accessing Spring Root Web Container
ApplicationContext pplicationContext=ContextLoader.getCurrentWebApplicationContext();
iProgramService =(IProgramService)applicationContext.getBean("ProgramService");
}
com.gps.quiz.service.model.ProgramVO programVO=new com.gps.quiz.service.model.ProgramVO();
BeanUtils.copyProperties(addProgramInput, programVO, new String[]{"timestamp"});
programVO.setTimestamp(DateUtils.getCurrentTimeIntoTimestamp());
String result=iProgramService.addTempProgram(programVO);
return result;
}
No comments:
Post a Comment