1
resposta

Utilizando TestRestTemplate com WildFly

Como seria configurar o TestRestTemplate(Spring Boot 1.5) com o WildFly? Tentei configurar, mas está apresentado o error a seguir:

@RunWith(SpringRunner.class)
@SpringBootTest(classes = {App.class}, webEnvironment = SpringBootTest.WebEnvironment.NONE)
@TestPropertySource( locations =  "classpath:application.properties")
public class Test1 {

    @Autowired
    private TestRestTemplate restTemplate;
}

Error:


org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/JndiDataSourceAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.jdbc.datasource.lookup.DataSourceLookupFailureException: Failed to look up JNDI DataSource with name 'java:jboss/datasources/medprev'; nested exception is javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
1 resposta
O post foi fechado por inatividade. Para continuar o assunto, recomendamos criar um novo tópico. Bons Estudos!