oghenez / mycila

Automatically exported from code.google.com/p/mycila
0 stars 0 forks source link

Make optional name attribute of @Bean #17

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Make optional name attribute of @Bean

=> Issue fixed in svn, will deploy release 2.3 this evening

Original issue reported on code.google.com by mathieu....@gmail.com on 3 Dec 2009 at 9:43

GoogleCodeExporter commented 8 years ago
This version is available in Maven 2 central repository and contains:

* A fix for Spring Plugin: Spring Test Listeners where not invoked correctly 
for each
test method

Here is an example of test using @Transactional:

@RunWith(MycilaJunitRunner.class)
@SpringContext(locations = "/ctx-tx.xml")
@TransactionConfiguration(transactionManager = "myTransactionManager")
public class SpringTxTest {

    @Autowired
    Dao dao;

    @Test
    @Transactional
    public void test() {
        dao.save();
    }
}

* The name attribute of @Bean annotation is now optional. If not provided, the 
name
of the field or method is used.

@Bean
String abean = "helloa";

* Spring Java config is now supported in @SpringContext annotation through the
classes attribute:

@RunWith(MycilaJunitRunner.class)
@SpringContext(locations = "/ctx-autowired2.xml", classes = MyJavaConfig.class)
@TransactionConfiguration(transactionManager = "myTransactionManager")
public class SpringJavaConfigTest {

    @Autowired
    Dao dao;

    @Autowired
    Autowired2Bean autowired2Bean;

    @Test
    @Transactional
    public void test() {
        assertNotNull(dao);
        assertNotNull(autowired2Bean);
        assertNotNull(autowired2Bean.dao);
        dao.save();
    }
}

Original comment by mathieu....@gmail.com on 4 Dec 2009 at 3:19