Announcement Announcement Module
Collapse
No announcement yet.
MailConfig Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MailConfig

    Hello there
    can someone explain me how to inject mail properties defined unders config/MailConfig.java
    I have an application.properties file generated with my mail.* properties in my target folder
    but it does seem to be injected in the @Value("#{environment['mail.*']}") parameters

    here is the piece of code inquestion
    PHP Code:
    @Configuration
    public class MailConfig {

        @
    Bean
        
    public JavaMailSender mailSender(@Value("#{environment['mail.host']?:'localhost'}"String host,
                @
    Value("#{environment['mail.port']?:25}"int port,
                @
    Value("#{environment['mail.username']}"String username,
                @
    Value("#{environment['mail.password']}"String password
                @
    Value("#{environment['mail.smtp.auth']?:false}"boolean mailSmtpAuth,
                @
    Value("#{environment['mail.smtp.starttls.enable']?:false}"boolean mailSmtpStartTls) {
    ...
        }

    Thanks for your help
    Last edited by pgherveou; Apr 13th, 2011, 02:24 PM.

  • #2
    Take a look at the ContainerInitializer (an ApplicationContextInitializer) that sets a profile that includes the application.properties loaded into the environment. Then notice how this initializer is referenced from web.xml.

    Comment


    • #3
      thks Keith I shoud have seen that

      Comment

      Working...
      X