title: Connecting to database using Spring JDBC
body: <p>I am trying to connect to my database using Spring JDBC</p>
  
  <p><code>Beans.xml</code></p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt;
  
     &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
          &lt;property name="driverClassName" value="org.postgresql.Driver" /&gt;
          &lt;property name="url" value="jdbc:postgresql://localhost:5434/lab1_aop" /&gt;
          &lt;property name="username" value="postgres" /&gt;
          &lt;property name="password" value="passw" /&gt;
     &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>The place I want to make the connection:</p>
  
  <pre><code>public class BookService { 
      private Connection connection;
  
      public BookService() {
           ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
      }
  }
  </code></pre>
  
  <p>I get these errors</p>
  
  <pre><code>The constructor ClassPathXmlApplicationContext(String) refers to the missing type BeansException    BookService.java
  The type org.springframework.beans.BeansException cannot be resolved. It is indirectly referenced from required .class files
  </code></pre>
  
  <p>What am I doing wrong?</p>