A
A
Alexander2015-01-27 13:48:21
Java
Alexander, 2015-01-27 13:48:21

How to translate from xml to Annotation?

how to translate below code into connection code with annotation?

<bean id="transactionManager"
        class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource" />
    </bean>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Pavlov, 2015-01-27
@Gribodemon1991

@Bean
public PlatformTransactionManager transactionManager(){
return new DataSourceTransactionManager(datasource());
}

@Bean
public DataSource datasource(){
return new OracleDataSource(); //настройте свой datasource тут 
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question