Reputation: 11
I need to Autowire service interface in my controller, passing parameter logcode in not default service constructor
@Controller
public class FooController {
private Foo foo;
@Autowired
private FooService fooService //(I like passe parameter here);
}
Here's my Service:
I need to Autowire service interface in my controller, passing parameter logcode in not default service constructor
@Service
public class FooServiceImpl implements FooService {
@Autowired
private FooDAO fooDAO;
public FooServiceImpl(String pLogCode)
{
}
@Transactional
public void addFoo(Foo foo) {
fooDAO.addFoo(foo);
}
}
Upvotes: 0
Views: 2196
Reputation: 342
Passing arguments when autowiring interfaces it's only possible in XML config. Simmilar question is here: Spring autowire interface
Upvotes: 1