Questions tagged [constructorargument]

11 questions
8
votes
3 answers

Can I use Ninject ConstructorArguments with strong naming?

Well, I don't know if "strong naming" is the right term, but what I want to do is as follows. Currently I use ConstructorArgument like e.g. this: public class Ninja { private readonly IWeapon _weapon; private readonly string _name; …
stiank81
  • 25,418
  • 43
  • 131
  • 202
5
votes
4 answers

Why can't I inject value null with Ninjects ConstructorArgument?

When using Ninjects ConstructorArgument you can specify the exact value to inject to specific parameters. Why can't this value be null, or how can I make it work? Maybe it's not something you'd like to do, but I want to use it in my unit tests..…
stiank81
  • 25,418
  • 43
  • 131
  • 202
3
votes
1 answer

How do I perform Constructor-based dependency injection with Spring using annotations?

OK, so if I need to put some primitive values in the constructor, how do I do that? @Autowired public CustomBean(String name, @Qualifier("SuperBean") SuperBean superBean) { super(); this.superBean = superBean; this.name =…
2
votes
0 answers

Error deploying Solidity contract: Expected 0 constructor arguments, got 6

I am trying to deploy a Solidity contract using a deployment script in Hardhat. However, I encountered an error during the deployment process.I'm using Hardhat as my development environment, and I have already compiled the contract successfully.…
2
votes
1 answer

Empty list in Python class constructor causes error

I'm creating a simple tree where each node has any number of children in Python, and I created a Node class to help me. Each node holds a reference to its parent node (int), and any children nodes (list). However, explicitly adding an empty list to…
Roshan
  • 23
  • 2
2
votes
0 answers

Spring bean array constructor argument

I have a problem with a spring bean configuration (r3.2.2). The application runs on a weblogic 10.3.5 and on project startup i get the following in the below stacktrace. In reading some other posts an array constructor has to be possible. Anyone…
1
vote
2 answers

C# web browser constructor

I am trying to add a web browser to an existing C# application, but, having not used C# in about 6 years, I am quite unfamiliar with how it works. I am trying to add the browser to a partial class (again, something I am not familiar with) using the…
Noble-Surfer
  • 3,052
  • 11
  • 73
  • 118
1
vote
4 answers

cannot access private member declared in class

this is my first question in here :) i have i little problem.. these are my classes: class Gracz{ char znak_gracza; public: Gracz(); Gracz(char znak){ this->znak_gracza = znak; }; friend void…
Nogaz
  • 29
  • 1
  • 1
  • 6
0
votes
1 answer

map Comparison Constructor Parameter

Is there a reason why I cannot pass a comparison functor to a map as a constructor argument: map> foo; //map foo(greater()); Doesn't work Or why I cannot pass a lambda without providing my own comparison…
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
0
votes
1 answer

unsure of concept of constructor args in spring beans

after watching various tutorials and doing some reading I understand how to use constructor arguments in spring. no issue there. my issue is can someone explain or point me to some material where it explains WHY they are used. what I mean by that,…
user4194400
0
votes
1 answer

Spring does not try to inject values to constructor-arg placeholder

I have this strange problem, that Spring does not try to pass defined values to placeholder in constructor-arg. Currently it is defined as ${myProperty} , but I could write anything there, there are no errors. It just passes the literal string…