We are using Lombok 1.16.18 to generate getters and setters for our Java Beans, and MapStruct 1.2.0. I'm getting a No qualifying bean of type 'com.gm.gpc.mapper.CarlineMapper' available exception (NoSuchBeanDefinitionException).
MapStruct doesn't seem to be generating the mapping class. Here is my Mapper Interface:
@Mapper
public interface CarlineMapper {
CarlineMapper INSTANCE = Mappers.getMapper( CarlineMapper.class );
CarlineDTO carlineToCarlineDTO(Carline carline);
Carline CarlineDTOToCarline(CarlineDTO carlineDTO);
}
And my service:
@Service
public class CarlineServiceImpl implements CarlineService {
@Autowired
private transient TrimPackageService trimPackageService;
@Autowired
MarketService marketService;
@Autowired
private transient CarlineService carlineService;
private static final Logger LOG = LoggerFactory.getLogger(CarlineServiceImpl.class);
private transient final CarlineRepository carlineRepository;
private transient final DozerBeanMapper dozerBeanMapper;
private transient final CarlineMapper carlineMapper;
@Autowired
public CarlineServiceImpl(final CarlineRepository carlineRepository, final DozerBeanMapper dozerBeanMapper, final CarlineMapper carlineMapper) {
Assert.notNull(carlineRepository, "CarlineRepository must not be null");
Assert.notNull(dozerBeanMapper, "dozerBeanMapper must not be null");
Assert.notNull(carlineMapper, "carlineMapper must not be null");
this.carlineRepository = carlineRepository;
this.dozerBeanMapper = dozerBeanMapper;
this.carlineMapper = carlineMapper;
}private CarlineDTO toDto(final Carline carline) {
final CarlineDTO dto = this.carlineMapper.INSTANCE.carlineToCarlineDTO(carline);
dto.setOriginalShortCode(carline.getShortCode());
dto.setOriginalName(carline.getName());
return dto;
}
private void save(final CarlineDTO carlineDto) {
final Carline carline = this.carlineMapper.INSTANCE.CarlineDTOToCarline(carlineDto);
this.carlineRepository.save(carline);
}
private void delete(final CarlineDTO carlineDTO) {
final Carline carline = this.carlineMapper.INSTANCE.CarlineDTOToCarline(carlineDTO);
this.carlineRepository.delete(carline.getId());
}
--
You received this message because you are subscribed to the Google Groups "mapstruct-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapstruct-use...@googlegroups.com.
To post to this group, send email to mapstru...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
@Mapper(componentModel = "spring")
public interface CarlineMapper {
CarlineDTO carlineToCarlineDTO(Carline carline);
Carline CarlineDTOToCarline(CarlineDTO carlineDTO);
}
@Service
public class CarlineServiceImpl implements CarlineService {
@Autowired
private CarlineMapper carlineMapper;
@Autowired
public CarlineServiceImpl(final CarlineRepository carlineRepository, final DozerBeanMapper dozerBeanMapper
, final CarlineMapper carlineMapper
) {
Assert.notNull(carlineRepository, "CarlineRepository must not be null");
Assert.notNull(dozerBeanMapper, "dozerBeanMapper must not be null");
Assert.notNull(carlineMapper, "carlineMapper must not be null");
this.carlineRepository = carlineRepository;
this.dozerBeanMapper = dozerBeanMapper;
this.carlineMapper = carlineMapper;
}
Thanks
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.gm.gsmc</groupId>
<artifactId>gpc_117490</artifactId>
<version>1.3.0.0-SNAPSHOT</version>
</parent>
<artifactId>gpc_auth_117490</artifactId>
<version>1.3.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>gpc_auth_117490</name>
<issueManagement>
<system>TFS</system>
<url>https://tfs.gm.com/tfs/GBRD/GPC_117490/</url>
</issueManagement>
<scm>
<connection>scm:git:git://bitbucket.gm.com/gpc/gpc.git</connection>
<developerConnection>scm:git:git://bitbucket.gm.com/gpc/gpc.git</developerConnection>
<url>https://bitbucket.gm.com/projects/GPC/repos/gpc/browse</url>
</scm>
<properties>
<start-class>com.gm.gpc.GpcAuthApplication</start-class>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<profile.name>prod</profile.name>
<org.mapstruct.version>1.2.0.CR1</org.mapstruct.version>
</properties>
<profiles>
<!-- skip tomcat deploy for production -->
<profile>
<id>PRODUCTION</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>1</id>
<phase>none</phase>
</execution>
<execution>
<id>2</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- skip tomcat deploy for local -->
<profile>
<id>LOCAL</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>1</id>
<phase>none</phase>
</execution>
<execution>
<id>2</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- skip tomcat deploy for PCF -->
<profile>
<id>PCF</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>1</id>
<phase>none</phase>
</execution>
<execution>
<id>2</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>DEV</id>
<properties>
<tomcat.deploy.url1>http://epgidvlbrd1935.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url1>
<profile.name>dev</profile.name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>1</id>
<phase>package</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<url>${tomcat.deploy.url1}</url>
<path>/ROOT</path>
<username>manager</username>
<password>Pa55w.rd</password>
<update>true</update>
</configuration>
</execution>
<!-- Skipping one of the deployment executions because there is only one dev server -->
<execution>
<id>2</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>SIT</id>
<properties>
<tomcat.deploy.url1>http://epgidvlbrd2016.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url1>
<tomcat.deploy.url2>http://epgidvlbrd2017.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url2>
</properties>
</profile>
<profile>
<id>UAT</id>
<properties>
<tomcat.deploy.url1>http://epgidvlbrd2020.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url1>
<tomcat.deploy.url2>http://epgidvlbrd2021.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url2>
</properties>
</profile>
<profile>
<id>PERF</id>
<properties>
<tomcat.deploy.url1>http://epgidvlbrd2025.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url1>
<tomcat.deploy.url2>http://epgidvlbrd2026.epga.nam.gm.com:15100/manager/text</tomcat.deploy.url2>
</properties>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>com.gm.gsmc</groupId>
<artifactId>gpc_utility_117490</artifactId>
<version>${project.version}</version>
</dependency>
<!-- All Spring dependencies-->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</exclusion>
<exclusion>
<artifactId>hibernate-entitymanager</artifactId>
<groupId>org.hibernate</groupId>
</exclusion>
<exclusion>
<artifactId>org.springframework</artifactId>
<groupId>spring-aspects</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Including this allows the war to be executable and deployable -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-batch</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml2-core</artifactId>
<version>1.0.2.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Utilities -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.5.1</version>
</dependency>
<!-- Swagger Libs -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
<type>jar</type>
<exclusions>
<exclusion>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- REST -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>
<!-- JPA -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.3-0-0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>3.0.10</version>
</dependency>
<!-- Add-on module to support JSR-310 (Java 8 Date & Time API) data types. -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.8.6</version>
</dependency>
<!-- Testing dependencies -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
<version>${org.mapstruct.version}</version>
</dependency>
</dependencies>
<build>
<defaultGoal>clean install</defaultGoal>
<!-- This allows GPC to run as / instead of /GPC on the server -->
<finalName>ROOT_pcf</finalName>
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/static/**</exclude>
<exclude>**/saml/**</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources/</directory>
<filtering>false</filtering>
<includes>
<include>**/static/**</include>
<include>**/saml/**</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.9.1</version>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>manifest.yml</file>
<type>yml</type>
<classifier>manifest</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
</plugin>
<!--Front-End Build-->
<!--cleaning Front-End Dist file-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<followSymLinks>false</followSymLinks>
<filesets>
<fileset>
<directory>src/main/resources/static/dist</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<!--NPM install and gulp build-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.4.0</version>
<executions>
<execution>
<id>exec-npm-install</id>
<phase>generate-sources</phase>
<configuration>
<executable>npm</executable>
<workingDirectory>src/main/resources/static</workingDirectory>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>exec-gulp-build</id>
<phase>generate-resources</phase>
<configuration>
<executable>gulp</executable>
<workingDirectory>src/main/resources/static</workingDirectory>
<arguments>
<argument>build</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Tomcat Deployment -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>1</id>
<phase>package</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<password>Pa55w.rd</password>
<path>/ROOT</path>
<update>true</update>
<url>${tomcat.deploy.url1}</url>
<username>manager</username>
<warFile>${project.build.directory}/ROOT-tomcat.war</warFile>
</configuration>
</execution>
<execution>
<id>2</id>
<phase>package</phase>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<password>Pa55w.rd</password>
<path>/ROOT</path>
<update>true</update>
<url>${tomcat.deploy.url2}</url>
<username>manager</username>
<warFile>${project.build.directory}/ROOT-tomcat.war</warFile>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<executions>
<!-- Tomcat War w/o Oracle Library -->
<execution>
<id>tomcat</id>
<goals>
<goal>war</goal>
</goals>
<configuration>
<warName>ROOT</warName>
<classifier>tomcat</classifier>
<packagingExcludes>
WEB-INF/lib/ojdbc7*.jar,
WEB-INF/lib/mysql*.jar
</packagingExcludes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<!-- Adds build information used by Spring Actuator for version service -->
<execution>
<id>build info</id>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<Implementation-Title>com.gm.gpc</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Build-Number>${jenkins.build.number}</Implementation-Build-Number>
<Implementation-SCM-Revision>${jenkins.build.scm.revision}</Implementation-SCM-Revision>
</additionalProperties>
</configuration>
</execution>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<attach>true</attach>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<!--
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
</annotationProcessorPaths>
-->
</configuration>
</plugin>
</plugins>
</build>
</project>
--
<dependency> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> <version>${org.mapstruct.version}</version>
<scope>provided</scope></dependency>