Coder Social home page Coder Social logo

Comments (2)

mnesarco avatar mnesarco commented on August 24, 2024

Hi Sander,

mybatis-cdi only recognize Mappers injected with @mapped at least once. So
if you have a mapper but you do not inject it with @Mapper somewhere...
mybatis-cdi will ignore it.

Cheers,

Frank.

On Fri, Feb 19, 2016 at 5:39 AM, sander78 [email protected] wrote:

Hi there,

We use mybatis-cdi in combination with java8. With the default
implementation now possible in interfaces this maken code like this
possible.

@Inject
public ItemRepoResolver(@Any Instance<ItemMapper<?>> itemMappers) {
this.itemMappers = itemMappers;
}

So we inject a list of Mappers of type ItemMapper and each mapper can say
for which type it can be used. For example:

`
public interface SavingsAccountMapper extends ItemMapper {

..some mapper code...
@OverRide https://github.com/Override
default Class forType() {
return SavingsAccount.class;
}
}
`

But since we do not use @Inject https://github.com/Inject @Mapper
https://github.com/Mapper SavingsAccountMapper this mapper is not
initialized. We can force this initialization by adding this field but we
do not need this.

So my question/issue is. Is is possible to inject a list of Mybatis
Mappers without the need to inject them in fields individually?

Thanks,
Sander


Reply to this email directly or view it on GitHub
#30.

Frank D. Martínez M.

from cdi.

sander78 avatar sander78 commented on August 24, 2024

Okay that's what I figured :)
By the way I just found out it wouldn't work anyway as Mybatis does not accept a default implementation in the interface and will throw an Exception. Too bad.

Thanks

from cdi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.