Referencing Values from Properties File in Components
# Define properties
bookstore.name=My Awesome Bookstore
bookstore.location=Main Street, Springfield@Component
public class BookstoreProperties {
@Value("${bookstore.name}")
private String name;
@Value("${bookstore.location}")
private String location;
// getters and setters
public void printBookstoreDetails() {
System.out.println("Bookstore Name: " + name);
System.out.println("Bookstore Location: " + location);
}
}PreviousProper vs. Improper Way to Implement CRUD in RESTful ServicesNextDisabling OAuth2 Security for Integration Tests with @TestConfiguration
Last updated