[BAEL-14089] - Removed PostRestApplication main class and adjusted configuration
This commit is contained in:
parent
a7febb73eb
commit
4d5d647e71
|
@ -83,6 +83,6 @@
|
||||||
<start-class>com.baeldung.SpringBootRestApplication</start-class>
|
<start-class>com.baeldung.SpringBootRestApplication</start-class>
|
||||||
<guava.version>27.0.1-jre</guava.version>
|
<guava.version>27.0.1-jre</guava.version>
|
||||||
<xstream.version>1.4.11.1</xstream.version>
|
<xstream.version>1.4.11.1</xstream.version>
|
||||||
<modelmapper.version>2.3.2</modelmapper.version>
|
<modelmapper.version>2.3.3</modelmapper.version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,13 +1,20 @@
|
||||||
package com.baeldung;
|
package com.baeldung;
|
||||||
|
|
||||||
|
import org.modelmapper.ModelMapper;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
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 class SpringBootRestApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(SpringBootRestApplication.class, args);
|
SpringApplication.run(SpringBootRestApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ModelMapper modelMapper() {
|
||||||
|
return new ModelMapper();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -24,8 +24,8 @@ import com.google.common.base.Preconditions;
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@PropertySource({ "classpath:persistence-${envTarget:h2}.properties" })
|
@PropertySource({ "classpath:persistence-${envTarget:h2}.properties" })
|
||||||
@ComponentScan({ "com.baeldung.persistence" })
|
@ComponentScan(basePackages = { "com.baeldung.persistence", "com.baeldung.modelmapper" })
|
||||||
@EnableJpaRepositories(basePackages = "com.baeldung.persistence.dao")
|
@EnableJpaRepositories(basePackages = {"com.baeldung.persistence.dao", "com.baeldung.modelmapper.repository"})
|
||||||
public class PersistenceConfig {
|
public class PersistenceConfig {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -39,7 +39,7 @@ public class PersistenceConfig {
|
||||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
||||||
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
|
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
|
||||||
em.setDataSource(dataSource());
|
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();
|
final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
|
||||||
// vendorAdapter.set
|
// vendorAdapter.set
|
||||||
|
|
Loading…
Reference in New Issue