Tag Archives: spirng boot

Spring boot prompt could not resolve placeholder in string value

1. Problem description

 

Spring boot refers to the configuration in YML in entity class

    @Value("${shiro.session.expireTime}")
    private final int expireTime = 30;

As soon as the project is started, an error is reported, indicating that could not resolve placeholder in string value. This error is basically caused by “configuration file not found”( application.yml )】

 

2. Solutions

 

Check whether the target / classes directory exists application.yml configuration file

If it exists, add the primary key of propertysource to the configuration class, and judge whether it exists according to the error log application.yml Configuration file.

@Configuration
@PropertySource("classpath:application.yml")
public class ShiroConfig {