Skip to content

Instantly share code, notes, and snippets.

@tmoreira2020
Created January 10, 2017 16:50
Show Gist options
  • Save tmoreira2020/f7ed779cdc7af716f40e9efbcab8d0ba to your computer and use it in GitHub Desktop.
Save tmoreira2020/f7ed779cdc7af716f40e9efbcab8d0ba to your computer and use it in GitHub Desktop.
@Component(immediate = true, property = {
"type=" + TemplateContextContributor.TYPE_GLOBAL }, service = TemplateContextContributor.class)
public class SabespTemplateContextContributor implements TemplateContextContributor {
protected WheatherService wheatherService;
@Override
public void prepare(Map<String, Object> contextObjects, HttpServletRequest request) {
contextObjects.put("wheaterService", wheatherService);
contextObjects.put("stringService", "teste");
System.out.println(contextObjects.containsKey("wheaterService"));
System.out.println(wheatherService);
System.out.println(contextObjects.get("wheaterService"));
}
@Reference
public void setWheatherService(WheatherService wheatherService) {
System.out.println(wheatherService);
this.wheatherService = wheatherService;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment