V
V
Vanes Ri_Lax2021-12-03 10:50:48
Java
Vanes Ri_Lax, 2021-12-03 10:50:48

Why can't I find annotations?

Good afternoon! I'm learning Spring, the lessons say how to use @PostConstruct, @PreDestroy. But why are they not available to me? With what it can be connected?
IDE: IntelliJ IDEA 2021.3 (Ultimate Edition)
Java: 11
Spring connected like this:

<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
      <version>5.3.13</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>5.3.13</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>5.3.13</version>
    </dependency>

The configuration file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd">
    
    <context:property-placeholder location="classpath:musicPlayer.properties"/>
    <context:component-scan base-package="org.example"/>
</beans>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
VaneS Ri_Lax, 2021-12-03
@vanesxl

Who can use

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question