Announcement Announcement Module
Collapse
No announcement yet.
Task Scheduler in Spring 4 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Task Scheduler in Spring 4

    Hi there,

    i started to wrk with spring some years ago. Now i transferred to AOP Spring. My Problem is now i have my application config and i am working mit @Transactional (which is working very good) and now i tried to use Spring-Task with @Scheduled. Here is my Setup.

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:task="http://www.springframework.org/schema/task"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
            http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
    
        <!-- Uncomment and add your base-package here: <context:component-scan base-package="org.springframework.samples.service"/> -->
        <!-- ====================== Imports (child contexts) ====================== -->
        <context:component-scan base-package="businesslogic.core"/>
        
        <!-- This tells Spring to activate annotation-driven transactions -->
        <tx:annotation-driven/>
        <!--<task:annotation-driven /> -->
        
        
        <!-- Access props files via spring framework -->
        <bean
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list>
                    <value>classpath:properties/midas.database.properties</value>
                    <value>classpath:properties/midas.fxcm.properties</value>
                </list>
            </property>
            <property name="ignoreUnresolvablePlaceholders" value="false" />
        </bean>
    
        <!-- Database Bean -->
    
        <bean id="dataSource"
            class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <property name="driverClassName" value="${db.driverClass}" />
            <property name="url" value="${db.jdbcUrl}" />
            <property name="username" value="${db.user}" />
            <property name="password" value="${db.password}" />
        </bean>
        
        <!-- Enable ORM Mapping with Hibernate -->
    
        <bean id="sessionFactory"
            class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
            <property name="packagesToScan" value="businesslogic.model"></property>
            <property name="dataSource" ref="dataSource"></property>
            <property name="hibernateProperties">
                <props>
                    <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
                    <prop key="hibernate.hbm2ddl.auto">create</prop>
                    <prop key="hibernate.jdbc.batch_size">0</prop>
                    <prop key="hibernate.show_sql">false</prop>
                    <prop key="hibernate.format_sql">true</prop>
                </props>
                
            </property>
        </bean>
    
        <bean id="transactionManager"
            class="org.springframework.orm.hibernate4.HibernateTransactionManager">
            <property name="sessionFactory" ref="sessionFactory" />
        </bean>
        
        <bean id="accountDao" class="businesslogic.dataaccess.impl.AccountDaoImpl">
            <property name="factory" ref="sessionFactory"></property>
        </bean>
        
        <bean id="credentialsDao" class="businesslogic.dataaccess.impl.CredentialsDaoImpl">
            <property name="factory" ref="sessionFactory"></property>
        </bean>
        
        
    </beans>
    With this File everything works fine, but when i enable
    Code:
    <task:annotation-driven />
    My Tomcat won't start anymore and i get this:

    Build path is incomplete. Cannot find class file for businesslogic.dataaccess.impl.CredentialsDaoImpl

    Can anyone help me?

    ​Thx Guys!

  • #2
    We are currently in the process of moving to stackoverflow.com for our forums. If you're still having this issue please consider asking it again at http://stackoverflow.com using the #spring tag. If you do post it there, please reply here with the link. Thanks!

    Comment

    Working...
    X