[BAEL-14089] - Removed PostRestApplication main class and adjusted configuration

This commit is contained in:
amit2103 2019-04-14 23:34:23 +05:30
parent a7febb73eb
commit 4d5d647e71
4 changed files with 12 additions and 25 deletions

View File

@ -83,6 +83,6 @@
<start-class>com.baeldung.SpringBootRestApplication</start-class>
<guava.version>27.0.1-jre</guava.version>
<xstream.version>1.4.11.1</xstream.version>
<modelmapper.version>2.3.2</modelmapper.version>
<modelmapper.version>2.3.3</modelmapper.version>
</properties>
</project>

View File

@ -1,13 +1,20 @@
package com.baeldung;
import org.modelmapper.ModelMapper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication(scanBasePackages = {"com.baeldung.persistence", "com.baeldung.spring", "com.baeldung.web" })
@SpringBootApplication
public class SpringBootRestApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootRestApplication.class, args);
}
@Bean
public ModelMapper modelMapper() {
return new ModelMapper();
}
}

View File

@ -1,20 +0,0 @@
package com.baeldung.modelmapper;
import org.modelmapper.ModelMapper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class PostApplication {
public static void main(String[] args) {
SpringApplication.run(PostApplication.class, args);
}
@Bean
public ModelMapper modelMapper() {
return new ModelMapper();
}
}

View File

@ -24,8 +24,8 @@ import com.google.common.base.Preconditions;
@Configuration
@EnableTransactionManagement
@PropertySource({ "classpath:persistence-${envTarget:h2}.properties" })
@ComponentScan({ "com.baeldung.persistence" })
@EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao")
@ComponentScan(basePackages = { "com.baeldung.persistence", "com.baeldung.modelmapper" })
@EnableJpaRepositories(basePackages = {"com.baeldung.persistence.dao", "com.baeldung.modelmapper.repository"})
public class PersistenceConfig {
@Autowired
@ -39,7 +39,7 @@ public class PersistenceConfig {
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" });
em.setPackagesToScan(new String[] { "com.baeldung.persistence.model", "com.baeldung.modelmapper.model" });
final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
// vendorAdapter.set