@component
public class emaillogserviceimpl implements emaillogservice {
private static final logger logger = loggerfactory.getlogger(emaillogserviceimpl.class);
@override
public void send(string email, string message) {
assert.notnull(email, "email must not be null!");
logger.info("send email:{},message:{}", email, message);
}
}
@configuration
public class logserviceconfig {
/**
* 扩展printlogservice行为,直接影响到logservice对象,因为logservice依赖于printlogservice.
*
* @return
*/
@bean
public printlogservice printlogservice() {
return new printlogserviceimpl();
}
@bean
public emaillogservice emaillogservice() {
return new emaillogserviceimpl();
}
@bean
public printlogservice consoleprintlogservice() {
return new consoleprintlogservice();
}
}