tmoreira2020
1/10/2017 - 4:50 PM

SabespTemplateContextContributor.java

@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;
	}
}