programing

기존 Spring 프로젝트를 Spring Boot로 마이그레이션하는 방법

yellowcard 2023. 8. 8. 21:27
반응형

기존 Spring 프로젝트를 Spring Boot로 마이그레이션하는 방법

기존 Spring 프로젝트를 Spring Boot로 마이그레이션하려고 합니다.프로젝트에서 이미 Spring Data JPA/Hibernate 및 JDBC(Postgre)를 사용한 단순 DAO를 사용했습니다.SQL 사용).몇몇 주에서는 Spring 부팅 시 마이그레이션해야 하는 것이 다음과 같습니다.

  1. 필요한 종속성 추가
  2. 진입점 @SpringBootApplication 추가
  3. 이익, 그게 다야.

종속성:

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring.boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>
<dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.9.4</version>
    </dependency>
<dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>2.0.5.RELEASE</version>
        </dependency>
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <version>1.4.7.RELEASE</version>
        </dependency>
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
            <version>1.4.7.RELEASE</version>
        </dependency>

종속성 관리 섹션에서 다음 오류가 발생했습니다.

Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/util/Optional;
    at org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension.postProcess(JpaRepositoryConfigExtension.java:125)
    at org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn(RepositoryConfigurationDelegate.java:127)
    at org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.java:83)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:359)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:143)
    at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:272)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:92)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    at ru.testproject.BootConfiguration.main(BootConfiguration.java:26)

그리고 그것 없이는:

Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.NoClassDefFoundError: org/eclipse/jetty/util/DeprecationWarning
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
    at ru.testproject.BootConfiguration.main(BootConfiguration.java:26)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/util/DeprecationWarning
    at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:159)
    at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:289)
    at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:211)
    at org.springframework.boot.context.embedded.jetty.JettyEmbeddedWebAppContext.<init>(JettyEmbeddedWebAppContext.java:28)
    at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory.getEmbeddedServletContainer(JettyEmbeddedServletContainerFactory.java:170)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134)
    ... 8 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.util.DeprecationWarning
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

진입점(구성 클래스도 가져오려고 합니다. 설명):

@SpringBootApplication
//@Import({DatabaseConfig.class, WebMvcConfig.class, WebAppConfig.class, WebSecurityConfig.class, WebServiceConfig.class})
public class BootConfiguration extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(BootConfiguration.class, args);
//        SpringApplication.run(new Class<?>[] {BootConfiguration.class, DatabaseConfig.class, WebMvcConfig.class, WebAppConfig.class, WebSecurityConfig.class, WebServiceConfig.class}, args);
    }

    @Bean
    public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() {
        JettyEmbeddedServletContainerFactory jettyContainer =
                new JettyEmbeddedServletContainerFactory();

        jettyContainer.setPort(9000);
        jettyContainer.setContextPath("");
        return jettyContainer;
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(BootConfiguration.class);
    }
}

구성:

@Configuration
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
@EnableJpaRepositories(basePackages = {
        "ru.testproject.hibernate"
})
@EnableTransactionManagement
@PropertySource("classpath:application.properties")
public class DatabaseConfig implements TransactionManagementConfigurer {

    @Bean
    public DataSource dataSource() {

        if (DB_TYPE_POSTGRESQL.equalsIgnoreCase(dbType)) {
            return postresqlDataSource();
        } else {
            return h2DataSource();
        }

    }

    @Bean
    public PlatformTransactionManager annotationDrivenTransactionManager() {
        return new JpaTransactionManager();
    }
}

제가 뭘 잘못하고 있는지 전혀 모르겠어요.기존 Jetty 서버 구성으로 스프링 부트 애플리케이션을 시작하려면 어떻게 해야 합니까?

업데이트 메인 폼을 수정했습니다.

<parent>
        <groupId>ru.testproject</groupId>
        <artifactId>test</artifactId>
        <version>1.0.1</version>
    </parent>

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring.boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

        </dependencies>
    </dependencyManagement>
...
<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-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web-services</artifactId>
            <!-- <version>${spring.boot.version}</version> -->
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
                 <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-validation</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jboss.logging</groupId>
                    <artifactId>jboss-logging</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-databind</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-annotations</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-validator</artifactId>
                </exclusion>

            </exclusions>
        </dependency>

<!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate-version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate-version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <version>1.0.1.Final</version>
        </dependency>

<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>4.2.1.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>4.2.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>4.2.0.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${spring.version}</version>
        </dependency>
<!-- Version 5.0.4 because ${spring.version} context fails with CandidateComponentsIndexLoader error (it introduced in 5.0.0 version) -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.0.4.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>

        <!-- Jetty embedded -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>

또한 스프링 부트 종속성에 대한 모든 태그에 대해 설명했습니다.mvc 의존성:tree는 다음과 같은 출력을 제공합니다.

[INFO] --- maven-dependency-plugin:3.0.2:tree (default-cli) @ test ---
[WARNING] The artifact org.hibernate:hibernate-infinispan:jar:5.3.3.Final has been relocated to org.infinispan:infinispan-hibernate-cache-v53:jar:9.3.0.Final
[INFO] ru.testproject:test:jar:2.4.41-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.8.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:1.5.8.RELEASE:test
[INFO] |  |  \- org.springframework.boot:spring-boot:jar:1.5.8.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.8.RELEASE:test
[INFO] |  |  \- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.8.RELEASE:compile
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.2.1:test
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.1:test
[INFO] |  +- org.assertj:assertj-core:jar:2.6.0:test
[INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] |  |  \- org.objenesis:objenesis:jar:2.1:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.4.0:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-core:jar:4.3.12.RELEASE:compile
[INFO] |  \- org.springframework:spring-test:jar:4.3.12.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.8.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.5.8.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.8.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.11:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.11:compile
[INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
[INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.8.RELEASE:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.8.11:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.8.RELEASE:compile
[INFO] |  |  \- org.apache.tomcat:tomcat-jdbc:jar:8.5.23:compile
[INFO] |  |     \- org.apache.tomcat:tomcat-juli:jar:8.5.23:compile
[INFO] |  +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:1.11.8.RELEASE:compile
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:1.13.8.RELEASE:compile
[INFO] |  |  +- org.springframework:spring-orm:jar:4.3.12.RELEASE:compile
[INFO] |  |  \- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
[INFO] |  \- org.springframework:spring-aspects:jar:4.3.12.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-jetty:jar:1.5.8.RELEASE:compile
[INFO] |  +- org.eclipse.jetty:jetty-webapp:jar:9.4.7.v20170914:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-xml:jar:9.4.7.v20170914:compile
[INFO] |  |  \- org.eclipse.jetty:jetty-servlet:jar:9.4.7.v20170914:compile
[INFO] |  |     \- org.eclipse.jetty:jetty-security:jar:9.4.7.v20170914:compile
[INFO] |  |        \- org.eclipse.jetty:jetty-server:jar:9.4.7.v20170914:compile
[INFO] |  +- org.eclipse.jetty.websocket:websocket-server:jar:9.4.7.v20170914:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-common:jar:9.4.7.v20170914:compile
[INFO] |  |  |  \- org.eclipse.jetty.websocket:websocket-api:jar:9.4.7.v20170914:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:websocket-client:jar:9.4.7.v20170914:compile
[INFO] |  |  |  \- org.eclipse.jetty:jetty-client:jar:9.4.7.v20170914:compile
[INFO] |  |  \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.4.7.v20170914:compile
[INFO] |  +- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.7.v20170914:compile
[INFO] |  |  +- org.eclipse.jetty:jetty-annotations:jar:9.4.7.v20170914:compile
[INFO] |  |  |  +- org.eclipse.jetty:jetty-plus:jar:9.4.7.v20170914:compile
[INFO] |  |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile
[INFO] |  |  |  +- org.ow2.asm:asm:jar:5.1:compile
[INFO] |  |  |  \- org.ow2.asm:asm-commons:jar:5.1:compile
[INFO] |  |  |     \- org.ow2.asm:asm-tree:jar:5.1:compile
[INFO] |  |  +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.4.7.v20170914:compile
[INFO] |  |  \- javax.websocket:javax.websocket-api:jar:1.0:compile
[INFO] |  \- org.mortbay.jasper:apache-el:jar:8.0.33:compile
[INFO] +- commons-fileupload:commons-fileupload:jar:1.3.1:compile
[INFO] +- org.springframework.boot:spring-boot-starter-web-services:jar:1.5.8.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-web:jar:1.5.8.RELEASE:compile
[INFO] |  +- org.springframework:spring-oxm:jar:4.3.12.RELEASE:compile
[INFO] |  \- org.springframework.ws:spring-ws-core:jar:2.4.0.RELEASE:compile
[INFO] |     \- org.springframework.ws:spring-xml:jar:2.4.0.RELEASE:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:5.3.3.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
[INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  +- org.hibernate.common:hibernate-commons-annotations:jar:5.0.4.Final:compile
[INFO] |  +- javax.persistence:javax.persistence-api:jar:2.2:compile
[INFO] |  +- net.bytebuddy:byte-buddy:jar:1.8.13:compile
[INFO] |  \- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:compile
[INFO] +- org.hibernate:hibernate-core:jar:5.3.3.Final:compile
[INFO] |  +- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  +- org.jboss:jandex:jar:2.0.5.Final:compile
[INFO] |  +- com.fasterxml:classmate:jar:1.3.4:compile
[INFO] |  \- javax.activation:javax.activation-api:jar:1.2.0:compile
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] +- org.hibernate:hibernate-osgi:jar:5.3.3.Final:compile
[INFO] |  +- javax.interceptor:javax.interceptor-api:jar:1.2:compile
[INFO] |  +- org.osgi:org.osgi.core:jar:6.0.0:compile
[INFO] |  \- org.osgi:org.osgi.compendium:jar:5.0.0:compile
[INFO] +- org.hibernate:hibernate-envers:jar:5.3.3.Final:compile
[INFO] +- org.hibernate:hibernate-hikaricp:jar:5.3.3.Final:compile
[INFO] +- org.hibernate:hibernate-proxool:jar:5.3.3.Final:compile
[INFO] |  \- proxool:proxool:jar:0.8.3:compile
[INFO] +- org.infinispan:infinispan-hibernate-cache-v53:jar:9.3.0.Final:compile
[INFO] |  +- org.infinispan:infinispan-hibernate-cache-commons:jar:9.3.0.Final:compile
[INFO] |  +- org.infinispan:infinispan-hibernate-cache-spi:jar:9.3.0.Final:compile
[INFO] |  \- org.infinispan:infinispan-core:jar:9.3.0.Final:compile
[INFO] |     +- org.infinispan:infinispan-commons:jar:9.3.0.Final:compile
[INFO] |     +- org.jgroups:jgroups:jar:4.0.12.Final:compile
[INFO] |     +- com.github.ben-manes.caffeine:caffeine:jar:2.3.5:compile
[INFO] |     +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] |     +- org.jboss.marshalling:jboss-marshalling-osgi:jar:2.0.5.Final:compile
[INFO] |     \- io.reactivex.rxjava2:rxjava:jar:2.1.3:compile
[INFO] |        \- org.reactivestreams:reactive-streams:jar:1.0.1:compile
[INFO] +- org.hibernate:hibernate-ehcache:jar:5.3.3.Final:compile
[INFO] |  \- net.sf.ehcache:ehcache:jar:2.10.4:compile
[INFO] +- wsdl4j:wsdl4j:jar:1.6.1:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.3.12.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.3.12.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.3.12.RELEASE:compile
[INFO] |  +- org.springframework:spring-expression:jar:4.3.12.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:4.3.12.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:4.2.1.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  \- org.springframework.security:spring-security-core:jar:4.2.3.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:4.2.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:4.2.0.RELEASE:compile
[INFO] |  \- org.springframework.security:spring-security-acl:jar:4.2.3.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:4.3.12.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:5.0.4.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:4.3.12.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:4.3.12.RELEASE:compile
[INFO] +- javax.xml.bind:jaxb-api:jar:2.3.0:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- commons-configuration:commons-configuration:jar:1.10:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] +- org.jdom:jdom:jar:2.0.2:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- xalan:xalan:jar:2.7.2:compile
[INFO] |  \- xalan:serializer:jar:2.7.2:compile
[INFO] |     \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO] +- org.apache.derby:derby:jar:10.11.1.1:compile
[INFO] +- org.postgresql:postgresql:jar:42.1.1:compile
[INFO] +- com.zaxxer:HikariCP:jar:2.6.3:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] +- jaxen:jaxen:jar:1.1.6:compile
[INFO] +- ru.testproject:test-conf:jar:2.4.41-SNAPSHOT:compile
[INFO] |  +- log4j:log4j:jar:1.2.16:compile
[INFO] |  +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
[INFO] |  \- ru.testproject:test-util:jar:2.4.41-SNAPSHOT:compile
[INFO] +- com.github.spullara.mustache.java:compiler:jar:0.9.0:compile
[INFO] +- org.quartz-scheduler:quartz:jar:2.2.1:compile
[INFO] |  \- c3p0:c3p0:jar:0.9.1.1:compile
[INFO] +- javax.json:javax.json-api:jar:1.0:compile
[INFO] +- org.apache.santuario:xmlsec:jar:2.0.6:compile
[INFO] |  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile
[INFO] |  |  +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |  |  \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] |  \- commons-codec:commons-codec:jar:1.10:compile
[INFO] +- org.eclipse.jetty:jetty-servlets:jar:9.3.5.v20151012:compile
[INFO] |  +- org.eclipse.jetty:jetty-continuation:jar:9.4.7.v20170914:compile
[INFO] |  +- org.eclipse.jetty:jetty-http:jar:9.4.7.v20170914:compile
[INFO] |  +- org.eclipse.jetty:jetty-util:jar:9.4.7.v20170914:compile
[INFO] |  \- org.eclipse.jetty:jetty-io:jar:9.4.7.v20170914:compile
[INFO] +- com.itextpdf:itextpdf:jar:5.5.12:compile
[INFO] +- org.bouncycastle:bcprov-jdk15on:jar:1.55:compile
[INFO] +- org.bouncycastle:bcmail-jdk15on:jar:1.55:compile
[INFO] +- org.bouncycastle:bcpkix-jdk15on:jar:1.55:compile
[INFO] +- com.google.guava:guava:jar:24.0-jre:compile
[INFO] |  +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] |  +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile
[INFO] |  +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile
[INFO] |  +- com.google.j2objc:j2objc-annotations:jar:1.1:compile
[INFO] |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile
[INFO] +- org.dom4j:dom4j:jar:2.1.0:compile
[INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.10:compile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile
[INFO] +- commons-net:commons-net:jar:3.6:compile
[INFO] +- org.samba.jcifs:jcifs:jar:1.2.19:compile
[INFO] \- org.reflections:reflections:jar:0.9.11:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.788 s
[INFO] Finished at: 2018-08-22T11:11:41+03:00
[INFO] ------------------------------------------------------------------------

어쨌든, 애플리케이션 시작 시에도 동일한 문제가 있습니다.

    Warning: SLF4J: Class path contains multiple SLF4J bindings.
    33:08.275 [main] DEBUG org.springframework.boot.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath:
 [main] ERROR org.springframework.boot.SpringApplication - Application startup failed
java.lang.NoSuchMethodError: org.springframework.util.ObjectUtils.unwrapOptional(Ljava/lang/Object;)Ljava/lang/Object;
        at org.springframework.validation.DataBinder.<init>(DataBinder.java:179)
        at org.springframework.boot.bind.RelaxedDataBinder.<init>(RelaxedDataBinder.java:83)
        org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:197)
        org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)
        at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)
        at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)
        at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325)
    org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
        at ru.testproject.BootConfiguration.main(BootConfiguration.java:26)
    cess finished with exit code 1

문제 해결:저는 의존성 문제를 해결했습니다.다음을 사용해야 합니다.

@Configuration
@EnableAutoConfiguration
@ComponentScan
@Import(Config.class)

대신@SpringBootApplication주석
이제 응용 프로그램이 부팅되고 있지만 다른 이야기인 구성 파일을 찾을 수 없습니다.

언급URL : https://stackoverflow.com/questions/51951513/how-to-migrate-existing-spring-project-to-spring-boot

반응형