Quantcast
Viewing all articles
Browse latest Browse all 7

Answer by meistermeier for SpringBoot application doesn't autowire field

You annotated your class with @Service and defined it manually as a bean with the @Bean annotation. I do think the second is the way you planned to use it. The @Service annotation will make this class get picked up by Spring's component scan and additionally create an instance of it. Of course it tries to resolve the parameters and fails when it tries to find a matching "bean" for the String field because there is no simple String bean (and should not :) ).

Remove the @Service annotation and everything should work as expected.


Viewing all articles
Browse latest Browse all 7

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>