I want to define a class to read the spring boot application.properties, this is the model class:
package com.dolphin.soa.post.common.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "dolphin.redis")
@ConfigurationPropertiesScan
public class CruiseRedisKeysConfig {
private String userSubArticleKey;
}
and this is the start up class:
@EnableConfigurationProperties(CruiseRedisKeysConfig.class)
public class AppStarter {}
but when I using this configuration, the userSubArticleKey value was null. why could not read the application.properties value? what should I do to fixed this problem? and this is the application.properties:
dolphin.redis.user.sub.article.key=cruise:user:sub:article: