Giter Club home page Giter Club logo

Comments (3)

robertotru avatar robertotru commented on July 17, 2024

Hi @ADarkDividedGem,
I much appreciated your gratitude. I would like to deserve more time to this project (e.g. I would like to migrate to Spring Boot 2.x), but I'm completely alone and due to other projects I can't afford everything alone at the moment.


Let's focus on the issue you are facing. I assume you use Spring Boot 1.5.x.

I have a few questions:

  1. Which OS are you running?
  2. If you run the app using the following code works?
import it.ozimov.springboot.mail.configuration.EnableEmailTools;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@EnableEmailTools
public class BasicApplication {
  public static void main (Stirng ... args) {
    SpringApplication.run(BasicApplication.class, args);
  }
}
  1. If you execute the following main works?
import it.ozimov.springboot.mail.configuration.EnableEmailTools;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@EnableEmailTools
public class BasicApplication {
  public static void main (Stirng ... args) {
        SpringApplication application = new SpringApplication(BasicApplication.class);        
        application.run(args);     
  }
}

Finally, can you try something like

@Configuration
public class OSBasedApplicationInitializer implements WebApplicationInitializer {     
  @Override    
  public void onStartup(ServletContext servletContext) throws ServletException {
        String profile = "production";
        if(SystemUtils.IS_OS_WINDOWS){
            profile = "development";
        }
        servletContext.setInitParameter("spring.profiles.active", profile);    
  }
}

from spring-boot-email-tools.

ADarkDividedGem avatar ADarkDividedGem commented on July 17, 2024

Thanks for the quick reply, after coming back to the problem with fresh eyes and thanks to your examples, a new perspective, I got it working.

Turns out there was nothing wrong with your code, instead it was just my misunderstanding of how profiles worked. After reading the documentation on Profile-specific Properties I assumed you needed to rename application.properties to application-default.properties for it to be recognised as the default properties file when adding additional profiles.

Once I renamed it back to application.properties the defaults properties for spring.mail. were loaded back in and the application ran fine.

Sorry for taking up your time, like you I am also working solo on my project so I appreciate all the help I can get.

from spring-boot-email-tools.

robertotru avatar robertotru commented on July 17, 2024

You can actually have one property file per profile or a single one that is multiprofile (and I think also a common properties and then those for the different profiles).

Glad everything works.
Best
R

from spring-boot-email-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.