aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/main/java/com/juick/configuration/UpdaterConfiguration.java
blob: b3c0424cc65d4b15b862f36b7deede7e6032ebe5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.juick.configuration;

import com.juick.database.MySqlUpdater;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.PlatformTransactionManager;

import javax.inject.Inject;

/**
 * Created by aalexeev on 12/13/16.
 */
@Configuration
public class UpdaterConfiguration {
    @Inject
    JdbcTemplate jdbcTemplate;
    @Inject
    PlatformTransactionManager transactionManager;

    @Bean
    @DependsOn({"jdbcTemplate", "transactionManager"})
    public MySqlUpdater updater() {
        return new MySqlUpdater(
                jdbcTemplate,
                transactionManager,
                "update.sql");
    }
}