[How to Fix] Spring boot startup error: could not resolve placeholder

When starting the whole spring boot project, an error occurred:
could not resolve placeholder

Reason: the configuration file is not specified, because there are multiple configuration files under Src/main/resources, such as application- dev.properties , boss.properties And so on.

method 1:
in application.properties Join in

spring.profiles.active= @[email protected]

Used to automatically decide which profile to choose.

Method 2: (not a good method)

// Added by yourself, specifying the configuration file
@PropertySource(value = "classpath:application-dev.properties", ignoreResourceNotFound = true)
public class DruidDBConfig {

    private static final Logger LOG = LoggerFactory.getLogger(DruidDBConfig.class);

    private String dbUrl;

    private String username;

Read More: