samedi 11 avril 2015

Autowired without component scan or setter/getter

Is it possible to @Autowired a field



@Repository( "categoryDao" )
public class SomeDaoImpl implements SomeDao {
@Autowired
private SessionFactory sessionFactory;
...
}


without using setter/getter or *component scan?


I have a config



<bean id="categoryDao" class="com.example.dao.SomeDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>

<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
...
</bean>

Aucun commentaire:

Enregistrer un commentaire