DWR - Null classes

Asked

Viewed 27 times

0

Expensive

I’m having trouble injecting the classes by calling some methods using DWR with Hibernate.

inserir a descrição da imagem aqui

Code:

@Controller
@Transactional
public class ManterArvoreClassificacaoController {

    @Autowired
    private ArvoreClassificacaoService acs;

    @Autowired
    private AreaArvoreClassificacaoService aacs;

    @Autowired
    private AreaService areaService;

    @Autowired
    private ArvoreSubClassificacaoService ascs;




    public List<ArvoreClassificacao> listarArvoresArea(Area area) {
        return acs.listarArvoresArea(area);
    }
    1. Your class ArvoreClassificacaoService is in fact a bean (is noted with @Service)? 2) This class is in a package below the class that has the method main() of its application? 3) The others Beans that controller work or are also null?
  • @Statelessdev, the service is marked as <@Service>. My application has no Main() method, it is a web application.

  • If you are using Spring Boot, you have a class annotated with at least, @SpringBootApplication and, within it, a method main(). It refers to this class that I asked you about and that should be in a package above all others, so that Spring can properly scan your classes and create Beans. If this is not followed, yours Beans are not scanned, are not created and this may be the reason your injections are null.

  • I’m using Spring MVC

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.