I'm fiddling with Springboot but each step forward brings me two steps back it seems.
I wired my simple app together with Springboot but I'm not getting this error:
Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataAccessException
As well as this:
Caused by: java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$EmbeddedDatabaseConfiguration due to org/springframework/dao/DataAccessException not found. Make sure your own configuration does not rely on that class. This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
I don't use any database. The app is very simple. Here is the main class:
@SpringBootApplication
public class Helloer {
public static void main(String[] args) {
ApplicationContext ctx = SpringApplication.run(Helloer.class, args);
A a = ctx.getBean(A.class);
a.speak();
}
}
Here are the other two classes A
and B
:
@Component
public class A {
@Autowired
private B b;
@Value("Covid 19")
private String calamity;
public void speak() {
b.writeToScreen(this.calamity);
}
}
@Component
public class B {
public void writeToScreen(String message) {
System.out.println(message);
}
}
And here is the config:
@Configuration
public class Config {
@Bean
public B b() {
return new B();
}
}
That's it. Simple as it can possibly be.
Here is the file structure as well as the build.gradle file content:
can someone please help me get this tiny program running by pointing me in the right direction as to the fix for this issue?
Thank you kindly in advance.