-1
Spring 응용 프로그램에 이상한 동작이 발생했습니다. 프로젝트에서 @Before annotation을 사용할 수없는 이유는 무엇입니까? "이전에 형식으로 해결할 수 없습니다"
나는이 같은 JUnit 테스트 클래스를 만들려고 오전 :public class AppTest {
@Before
public void setUp() {
// Create the application from the configuration
ApplicationContext context = new AnnotationConfigApplicationContext(ApplicationConfig.class)
// Look up the application service interface
service = (TransferService) context.getBean(TransferService.class);
}
}
가장 큰 문제는 내가 설정() 방법에 @Before 주석에 오류를 얻을 수 있다는 것입니다. 전에이는 @Before 주석에 대한 종속성을 찾을 수있는 것 같다 유형
에 해결 될 수없는 : 그것은 나에게 말한다. 나는 무엇을 놓치고
<properties>
<org.springframework.version>3.2.16.RELEASE</org.springframework.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Bean Factory and JavaBeans utilities (depends on spring-core) Define
this if you use Spring Bean APIs (org.springframework.beans.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Core utilities used by other modules. Define this if you use Spring
Utility APIs (org.springframework.core.*/org.springframework.util.*) -->
<!-- Aspect Oriented Programming (AOP) Framework (depends on spring-core,
spring-beans) Define this if you use Spring AOP APIs (org.springframework.aop.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Application Context (depends on spring-core, spring-expression, spring-aop,
spring-beans) This is the central artifact for Spring's Dependency Injection
Container and is generally always defined -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Various Application Context utilities, including EhCache, JavaMail,
Quartz, and Freemarker integration Define this if you need any of these integrations -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Transaction Management Abstraction (depends on spring-core, spring-beans,
spring-aop, spring-context) Define this if you use Spring Transactions or
DAO Exception Hierarchy (org.springframework.transaction.*/org.springframework.dao.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- JDBC Data Access Library (depends on spring-core, spring-beans, spring-context,
spring-tx) Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
<dependency>
<groupId>FTP-MANAGER</groupId>
<artifactId>FTP-MANAGER</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
-->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<!-- JDBC 3.0 driver for Microsoft SQL Server and Sybase -->
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2.4</version>
</dependency>
<!-- Contiene la classe BasicDataSource -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
:
이 내 의 pom.xml 파일에있는 종속성은? 뭐가 잘못 되었 니? 이 문제를 어떻게 해결할 수 있습니까?
import 문이 있습니까? 결국 모든 주석은 자바 클래스 일뿐입니다. 1) jar/class 파일과 2) 자신의 코드에 import 문을 넣으십시오. – GhostCat
ctrl + shift + O (windows) 또는 cmd + shift + O (mac)를 사용하여 가져 오기를 구성하십시오 (이클립스 또는 STS) – ddb
이 특정 문장을 가져올 수 없습니다. 그것은 "내 앞에 주석 만들기"라고 말합니다. 그래서 나는 뮤 의존성에 빠지지 않았 음을 의미합니다. – AndreaNobili