title: Spring JPA cannot pass through EntityDao
body: <p>So i have this problem with testing Spring JPA, Here it's my code:</p>
  
  <p><code>ArticleService</code>:</p>
  
  <pre><code>@Service("articleService")
  @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
  public class ArticleServiceImpl implements ArticleService {
  
  
  private ArticleDao articleDao;
  
    @Autowired
    public ArticleServiceImpl(ArticleDao articleDao) {
      this.articleDao = articleDao;
    }
  
    public ArticleServiceImpl() {
    }
  
    @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
    public void addArticle(Article article) {
      articleDao.saveArticle(article);
    }
  }
  </code></pre>
  
  <p>My <code>ArticleDao</code>:</p>
  
  <pre><code>@Repository("articleDao")
  public class ArticleDaoImpl implements ArticleDao {
  
    private EntityManager em;
  
    @PersistenceContext
    public void setEntityManager(EntityManager em) {
      this.em = em;
    }
  
    // To Save the article detail
    public void saveArticle(Article article) {
      article.setAddedDate(new Date());
      em.persist(article);
    }
  }
  </code></pre>
  
  <p>Problem lies in executing those methods in the <code>InputDatabaseServiceImpl</code> class.</p>
  
  <pre><code>public class InputDatabaseServiceImpl implements InputDatabaseService {
  
  public ArticleService articleService;
  
  
  public InputDatabaseServiceImpl(ArticleService articleService){
      this.articleService= articleService;
  }
  
  public int inputArticle(Article article) {
      articleService.saveArticle(article);
      return 0;
  }
  </code></pre>
  
  <p>aplication <code>appContext.xml</code></p>
  
  <pre><code>&lt;context:property-placeholder location="/WEB-INF/database.properties" /&gt;
  
  &lt;tx:annotation-driven transaction-manager="transactionManager" /&gt; 
  
  &lt;!-- Declare a datasource that has pooling capabilities--&gt; 
  &lt;bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
  destroy-method="close"
  p:driverClass="${database.driver}"
  p:jdbcUrl="${database.url}"
  p:user="${database.user}"
  p:password="${database.password}"
  p:acquireIncrement="5"
  p:idleConnectionTestPeriod="60"
  p:maxPoolSize="100"
  p:maxStatements="50"
  p:minPoolSize="10" /&gt;
  
  &lt;!-- Declare a JPA entityManagerFactory--&gt;
  &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" &gt;
  &lt;property name="persistenceXmlLocation" value="classpath*:META-INF/persistence.xml"&gt;&lt;/property&gt;
  &lt;property name="persistenceUnitName" value="hibernatePersistenceUnit" /&gt;
  &lt;property name="dataSource" ref="dataSource"/&gt;
  &lt;property name="jpaVendorAdapter"&gt;
  &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" &gt;
  &lt;property name="showSql" value="true"/&gt;
  &lt;/bean&gt;
  &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;!-- Declare a transaction manager--&gt;
  &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt;
  &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt;
  &lt;/bean&gt; 
  &lt;/beans&gt;
  </code></pre>
  
  <p>Whenever i call <code>inputArticle</code> Class from my <code>endpoint</code> i got <code>NullPointerExpcetion</code> in line <code>articleService.saveArticle(article);</code></p>
  
  <p>I knew it is the easiest Exception to solve but i am struggeling with this since a while and i need help.. Anyone could give me a hint what am i missing?</p>