Package sk.vrto

Source Code of sk.vrto.InjectorConfiguration

package sk.vrto;

import org.hibernate.SessionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import sk.vrto.domain.EmailAccount;
import sk.vrto.domain.User;
import sk.vrto.service.crypto.SaltGenerator;
import sk.vrto.service.crypto.SaltedAESStringEncrypter;
import sk.vrto.service.crypto.StringEncrypter;
import sk.vrto.service.domain.ContactCreator;
import sk.vrto.service.email.SmtPropertiesFactory;

import java.util.Properties;

@Configuration
public class InjectorConfiguration {

    @Bean(name = "app.saltedAesEncrypter")
    public StringEncrypter saltedAESStringEncrypter() {
        return new SaltedAESStringEncrypter(new SaltGenerator());
    }

    @Bean(name = "app.hotmailProperties")
    public Properties hotmailProperties() {
        return SmtPropertiesFactory.hotmailProperties();
    }

    @Bean(name = "app.hotmail")
    public EmailAccount hotmail() {
        return new EmailAccount("diplomka.misova@hotmail.com",
                saltedAESStringEncrypter().encrypt("5RocnikFRI"));
    }

    @Bean(name = "app.user")
    public User user() {
        return new User("testuser", "testuser", hotmail());
    }

    @Bean(name = "dao.contactCreator")
    public ContactCreator contactCreator() {
        return new ContactCreator();
    }

    @Bean(name = "view.emailLimit")
    public Integer emailLimit() {
        return 6;
    }

}
TOP

Related Classes of sk.vrto.InjectorConfiguration

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.