Take the following as an example
public class xyz(){
@Autowired
private BasicConfiguration configuration;
@RequestMapping("/dynamic-configuration")
public Map dynamicConfiguration() {
// Not the best practice to use a map to store differnt types!
Map map = new HashMap();
map.put("message", configuration.getMessage());
map.put("number", configuration.getNumber());
map.put("key", configuration.isValue());
return map;
}
}
Every documentation i read says that it injects dependecies
, however i dont understand what that means. As far as i understand, Spring
creates a JavaBean
of the class xyz
and a javabean
is a basically a standard for classes. If so, what use has the@autowire
here?. Doesn't xyz
have the same object "configuration"
whether I annotate it or not?.