Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unable to proxy method" while using SqlSessionDaoSupport #201

Closed
e7868a opened this issue May 18, 2017 · 3 comments
Closed

"Unable to proxy method" while using SqlSessionDaoSupport #201

e7868a opened this issue May 18, 2017 · 3 comments
Labels

Comments

@e7868a
Copy link

e7868a commented May 18, 2017

create a DAO class like following

public interface SomeDAO extends SomeMapper {
     void foo();
}

@Repository
public class SomeDAOImpl extends SqlSessionDaoSupport implements SomeDAO {
    private SomeMapper mapper;

    @Autowired
    @Override
    public void setSqlSessionFactory(@Qualifier("someSqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
        super.setSqlSessionFactory(sqlSessionFactory);
    }

    @PostConstruct
    public void init() {
        mapper = this.getSqlSession().getMapper(SomeMapper.class);
    }

    @Override
    public void foo() {
    }
}

spring output following logs:

2017-05-18 14:17:45.638 INFO 43600 --- [ main] o.s.aop.framework.CglibAopProxy : Unable to proxy method [public final void org.springframework.dao.support.DaoSupport.afterPropertiesSet() throws java.lang.IllegalArgumentException,org.springframework.beans.factory.BeanInitializationException] because it is final: All calls to this method via a proxy will NOT be routed to the target instance.

Is it OK to ignore this?

PS: I am using Spring Boot 1.4.5.RELEASE

@kazuki43zoo
Copy link
Member

@e7868a Why extends the SqlSessionDaoSupport ? You can inject the Mapper interface directly.

@kazuki43zoo
Copy link
Member

@e7868a Could you provide a reproduce project on GitHub ?

@e7868a
Copy link
Author

e7868a commented Jun 14, 2017

@kazuki43zoo you are right.I needn't use SqlSessionDaoSupport. I should inject the Mapper interface directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants