You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because the class V8Engine is the the concrete type being returned by the EngineFactory class's v8Engine method, wouldn't that mean the V8Engine class is meant to represent third party code one may want to treat as a bean, injecting instances of it into parts of their application? The V8Engine class has no annotations, so that's consistent with my interpretation of the example. But it depends on the CrankShaft class and Engine interface, both of which I'm interpreting as being one's own code. CraftShaft, because it has the @Singleton annotation. Engine, because it wouldn't make sense to use an interface provided by third party code. In my opinion, it would make sense to define your own interfaces and use them to connect different parts of your application together.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm confused by a part of the documentation: https://docs.micronaut.io/latest/guide/#factories
Right now, the code is this:
Because the class
V8Engine
is the the concrete type being returned by theEngineFactory
class'sv8Engine
method, wouldn't that mean theV8Engine
class is meant to represent third party code one may want to treat as a bean, injecting instances of it into parts of their application? TheV8Engine
class has no annotations, so that's consistent with my interpretation of the example. But it depends on theCrankShaft
class andEngine
interface, both of which I'm interpreting as being one's own code.CraftShaft
, because it has the@Singleton
annotation.Engine
, because it wouldn't make sense to use an interface provided by third party code. In my opinion, it would make sense to define your own interfaces and use them to connect different parts of your application together.Beta Was this translation helpful? Give feedback.
All reactions