constract和 property的写法

<beans profile="test,local">-->
    <!--&lt;!&ndash; 本地,测试环境的 mail 服务配置 &ndash;&gt;-->
    <!--<bean name="sendMailService" class="cn.focus.dc.app.xinfang.service.SendMailService">-->
    <!--<constructor-arg index="0"-->
    <!--type="org.apache.velocity.app.VelocityEngine"-->
    <!--ref="velocityEngine" />-->
    <!--<constructor-arg index="1"-->
    <!--type="org.springframework.mail.javamail.JavaMailSender" ref="mailSender" />-->
    <!--<constructor-arg index="2" type="java.lang.String"-->
    <!--value="${mail.from}" />-->
    <!--</bean>-->
    <!--</beans>-->


        <!-- SCE 测试环境及正式环境下 mail 服务配置 -->
        <bean name="sendMailService" class="cn.focus.dc.app.xinfang.service.SendMailService">
            <constructor-arg index="0" type="org.apache.velocity.app.VelocityEngine"
                             ref="velocityEngine"/>
            <property name="from" value="****@sohu-inc.com"/>
        </bean>

@Autowired
    private VelocityEngine velocityEngine;

    private String from;

    public SendMailService() {
    }

    public SendMailService(VelocityEngine velocityEngine) {
        this.velocityEngine = velocityEngine;
    }


    public SendMailService(String from) {
        this.from = from;
    }

你可能感兴趣的:(property)