Вот картограф
Код: Выделить всё
@Mapper(componentModel = "spring")
public interface UserEntityMapper {
@Mapping(source = "password", target = "password")
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
void updatePasswordFromDTO(PasswordResetRequest dto, @MappingTarget User entity);
}
Но когда я попытался сделать то же самое в своем классе уровня сервиса,
Код: Выделить всё
@Service
@Transactional
public class AccountServiceImpl implements IAccountService {
...
@Autowired
private UserEntityMapper userMapper;
...
}
Код: Выделить всё
***************************
APPLICATION FAILED TO START
***************************
Description:
Field userMapper in com.application.services.AccountServiceImpl required a bean of type 'com.application.mappers.UserEntityMapper' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.application.mappers.UserEntityMapper' in your configuration.
Код: Выделить всё
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.5.5
com.myproject
myproject
0.0.1-SNAPSHOT
authentication-template
Description
11
org.springframework.boot
spring-boot-starter-data-jpa
org.springframework.boot
spring-boot-starter-mail
org.springframework.boot
spring-boot-starter-security
org.springframework.boot
spring-boot-starter-validation
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-devtools
runtime
true
mysql
mysql-connector-java
runtime
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
org.springframework.security
spring-security-test
test
io.jsonwebtoken
jjwt
0.9.1
org.springframework.boot
spring-boot-starter-freemarker
org.mapstruct
mapstruct
1.4.2.Final
org.springframework.boot
spring-boot-maven-plugin
org.projectlombok
lombok
- Ответ @Som
- Ответ @Gunnar
Вот файл @SpringBootApplication.
Код: Выделить всё
@SpringBootApplication
@PropertySources(value = {
@PropertySource("classpath:mail.properties"),
@PropertySource("classpath:messages.properties"),
@PropertySource("classpath:security.properties")
})
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Структура пакета проекта

Пожалуйста, помогите, спасибо

Подробнее здесь: https://stackoverflow.com/questions/695 ... uct-mapper