javaspringspring-mvcspring-bootproperty-placeholder

value placeholder in Domain classes


I have a maven project in Eclipse called TdkUtils, with this pom.xml: This is a utils project. So I want to create a jar, put it in the repository and use it in another projects.

I have this domain class:

@PropertySource("recommended-mobile.properties")
public class RemoteUnit implements Serializable {

    private static final long serialVersionUID = 1L;

    private RemoteUnitType remoteUnitType;

    private long remoteUnitId;

    private String serialNumber;

    private String imei;

    private String softwareVersion;

    private String msisdn;

    @Value("${AX1}")
    private String firmwareAX1;

    @Value("${AX1Pro}")
    private String firmwareAX1Pro;

    @Value("${AX5}")
    private String firmwareAX5;

 ...
}

But it's not replacing the values at all. Maybe its only possible in the config files ?

I also tries to put the values in the file application.properties with the same result

I also have in the configuration file the path to the domain classes

@ComponentScan(value="com.tdk.domain")

Solution

  • Try adding the ComponentScan("package PathOfYourDomainClassGoesHere") annotation on your Configuration class