Add init-method example

This commit is contained in:
Grzegorz Piwowarek
2016-08-14 08:58:25 +02:00
parent b759bf7c59
commit d27db567c1
3 changed files with 55 additions and 0 deletions
@@ -0,0 +1,24 @@
package org.baeldung.startup;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import java.util.Arrays;
@Component
@Scope(value = "prototype")
public class InitMethodExampleBean {
private static final Logger LOG = Logger.getLogger(InitMethodExampleBean.class);
@Autowired
private Environment environment;
public void init() {
LOG.info(Arrays.asList(environment.getDefaultProfiles()));
}
}