title: Spring Boot application requires defining default beans in a @Configuration class for @Value to be used?
body: <p>Recently, I have encountered a pretty strange situation. </p>
  
  <p>Please, consider a simple Spring Boot application:</p>
  
  <pre><code>@SpringBootApplication
  public class SampleApp implements WebMvcConfigurer {
  
      public static void main(String[] args) {
              SpringApplication.run(SampleApp.class, args);
      }
  }
  </code></pre>
  
  <p>Inside this SampleApp, we do have a Configuration class such as:</p>
  
  <pre><code>@Configuration
  public class Config {
  
      //Some @Bean definitions, but without things such as String
  }
  </code></pre>
  
  <p>And then we do have some class:</p>
  
  <pre><code>@Service
  @RequiredArgsConstructor //Lombok
  public class SomeService {
  
      @Value("${value.to.be.injected}")
      private final String someValue;
  }
  </code></pre>
  
  <p>With the current state of things, the application refuses to launch:</p>
  
  <pre><code>***************************
  APPLICATION FAILED TO START
  ***************************
  Description:
  
  Parameter 0 of constructor in com.sampleapp required a bean of type 'java.lang.String' that could not be found.
  
  Action:
  
  Consider defining a bean of type 'java.lang.String' in your configuration.
  </code></pre>
  
  <p>However, should we define a <code>@Bean</code> in our configuration such as:</p>
  
  <pre><code>@Configuration
  public class Config {
  
      @Bean
      public String string() {
          return new String();
      }
  }
  </code></pre>
  
  <p>The application launches correctly, and even more, injects the value correctly. Why does that happen, and why does Spring act like this?</p>