To move your Spring beans defined in the file XMLto the configuration class (marked @Configuration), you need something like this:
@Configuration
public class MyConfig {
@Bean(name="executeTimeInterceptor")
public ExecuteTimeInterceptor getExecuteTimeInterceptor() {
return new com.mkyong.common.interceptor.ExecuteTimeInterceptor();
}
@Bean(name="maintenanceInterceptor")
public MaintenanceInterceptor getMaintenanceInterceptor(@Value("${properties.maintenanceStartTime}") int maintenanceStartTime,
@Value("${properties.maintenanceEndTime}") int maintenanceEndTime,
@Value("${properties.maintenanceMapping}") String maintenanceMapping) {
MaintenanceInterceptor myInt = new MaintenanceInterceptor();
myInt.setMaintenanceStartTime(maintenanceStartTime);
myInt.setmMaintenanceEndTime(maintenanceEndTime);
myInt.setMaintenanceMapping(maintenanceMapping);
return myInt;
}
}
... propertiesFile.properties ...
properties.maintenanceStartTime=23
properties.maintenanceEndTime=24
properties.maintenanceMapping=/SpringMVC/maintenance.htm
, Environment, @Value , .