I am trying to executing basic testcase, which I have completed doing setup and I am getting below error:
java.lang.NoClassDefFoundError: org/junit/platform/engine/EngineDiscoveryListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.getLauncherDiscoveryListener(LauncherDiscoveryRequestBuilder.java:241)
at org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder.build(LauncherDiscoveryRequestBuilder.java:235)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createUnfilteredTest(JUnit5TestLoader.java:75)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.createTest(JUnit5TestLoader.java:66)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.loadTests(JUnit5TestLoader.java:53)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:526)
Find below my ConfigServer class:
package org.siaa.devops;
import java.util.Hashtable;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cloud.config.server.EnableConfigServer;
import com.jcraft.jsch.JSch;
#SpringBootApplication
#EnableConfigServer
public class ConfigServer extends SpringBootServletInitializer {
private static final String PREFERRED_AUTENTICATION_MODE = "publickey";
public static void main(String[] args) {
// Hack in JSCH to avoid interactive session
// Override PreferredAuthentications in JSCH
Hashtable<String, String> config = new Hashtable<String, String>();
config.put("PreferredAuthentications", PREFERRED_AUTENTICATION_MODE);
JSch.setConfig(config);
SpringApplication.run(ConfigServer.class, args);
}
#Override
protected SpringApplicationBuilder configure(
SpringApplicationBuilder application) {
return application.sources(ConfigServer.class);
}
}
build.gradle
group 'org.siaa.develop'
buildscript {
ext {
//springBootVersion = '1.5.4.RELEASE'
//springBootVersion = '2.0.6.RELEASE'
springBootVersion = '2.2.6.RELEASE'
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: "io.spring.dependency-management"
apply plugin: 'org.springframework.boot'
apply plugin: 'java'
apply plugin: 'eclipse'
//version = '0.0.1-SNAPSHOT'
//springBoot {
//executable = true
//}
bootJar {
launchScript()
}
ext {
springCloudVersion = 'Hoxton.SR3'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
//mavenCentral()
maven {
url 'http://artifactory.siaa.org/artifactory/siaa-mp-develop'
}
}
dependencies {
compile('org.springframework.cloud:spring-cloud-config-server:2.2.2.RELEASE')
compile('org.springframework.boot:spring-boot-starter-actuator:2.2.6.RELEASE')
compile('org.springframework.cloud:spring-cloud-security:2.2.1.RELEASE')
testCompile('org.springframework.boot:spring-boot-starter-test')
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
//Kafka and spring cloud config monitor
compile('org.springframework.cloud:spring-cloud-starter-bus-kafka:2.0.0.RELEASE')
compile('org.springframework.cloud:spring-cloud-config-monitor:2.2.1.RELEASE')
//Prometheus
compile('io.micrometer:micrometer-registry-prometheus')
implementation("org.junit.jupiter:junit-jupiter:5.6.0")
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
Added testcase is ConfigServerTest
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
#RunWith(SpringRunner.class)
#SpringBootTest
public class ConfigServerTest {
#Test
public void contextLoads() {
}
}
I have done research and same code seems to working fine in other machine but causing issue in my local.
Unable to fix it. Please help me out with it.
Gradle version I am using is: Gradle-6.5.1
Java (JRE)version :1.8.0_40
Thanks in advance.
Related
My Minecraft Plugin doesn't load
I tried reinstalling Java
rebuilding the jar
and tried to remake the code
I used java 11
in IntelliJ Idea
and I used Minecraft 1.15.2
on MacOS 10.15.7
and I coded in Kotlin
Error Message:
org.bukkit.plugin.InvalidPluginException: Abnormal plugin type
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:80) ~[spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) [spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at org.bukkit.craftbukkit.v1_15_R1.CraftServer.loadPlugins(CraftServer.java:353) [spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at net.minecraft.server.v1_15_R1.DedicatedServer.init(DedicatedServer.java:210) [spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:784) [spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.InstantiationException
at jdk.internal.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48) ~[?:?]
at java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[?:?]
at java.lang.Class.newInstance(Class.java:584) ~[?:?]
at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:76) ~[spigot-1.15.2.jar:git-Spigot-a99063f-be6aaf0]
... 7 more
My Main Class the only Class that the Project have (it is in Kotlin):
package main
import org.bukkit.Bukkit
import org.bukkit.command.Command
import org.bukkit.command.CommandExecutor
import org.bukkit.command.CommandSender
import org.bukkit.entity.Entity
import org.bukkit.entity.Player
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerJoinEvent
import org.bukkit.inventory.PlayerInventory
import org.bukkit.plugin.PluginManager
import org.bukkit.plugin.java.JavaPlugin
public abstract class Loader : JavaPlugin(), Listener, CommandExecutor{
override fun onEnable() {
Bukkit.broadcastMessage("Aura Plugin test by Woody1474747")
}
override fun onCommand(sender: CommandSender, command: Command, label: String, args: Array<out String>): Boolean {
if(sender is Player){
when(command.name){
"aura" -> {
val plinv:PlayerInventory = sender.getInventory()
val item1 = plinv.getItem(0)
val item8 = plinv.getItem(8)
sender.sendMessage(item1.toString())
}
}
}
return true
}
}
My plugin.yml
name: auraplugtest
version: 1.0.0
description: fsaf
main: main.Loader
commands:
aura:
usage: /<command>
My build.gradle:
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
id 'com.github.johnrengelman.shadow' version '2.0.4'
}
group 'org.example'
version '1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
repositories {
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
content {
includeGroup 'org.bukkit'
includeGroup 'org.spigotmc'
}
}
maven {
url = 'https://oss.sonatype.org/content/repositories/snapshots'
}
}
dependencies {
compileOnly 'org.bukkit:bukkit:1.14.4-R0.1-SNAPSHOT'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile group: 'junit', name: 'junit', version: '4.12'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
The answer is simple, your class cannot be abstract!
Fixed code:
// removed abstract keyword
public class Loader : JavaPlugin(), Listener, CommandExecutor {
// ...
}
I get an error in he "import org.springframework.data cannot be
resolved" in following code
package com.steinko.reactsprinboottutorial.RestfulWebService;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
#Repository
public interface TodoRepository extends CrudRepository<Todo, Long>{
List<Todo> findByName(String Name);
}
The gradle build.gradle looks like
plugins {
id 'org.springframework.boot' version '2.3.3.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
}
apply plugin: 'java'
apply plugin: 'eclipse'
repositories {
mavenCentral()
jcenter()
mavenLocal()
// maven { url "http://dl.bintray.com/epam/reportportal" }
}
sourceCompatibility = '14'
sourceSets {
intTest {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
configurations {
intTestImplementation.extendsFrom implementation
intTestCompile.extendsFrom testCompile
intTestRuntimeOnly.extendsFrom runtimeOnly
}
dependencies {
//implementation 'com.epam.reportportal:logger-java-log4j:5.0.2'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.modelmapper:modelmapper:2.3.8'
// https://mvnrepository.com/artifact/javax.validation/validation-api
compile group: 'javax.validation', name: 'validation-api', version: '2.0.1.Final'
implementation 'org.springframework.boot:spring-boot-starter-validation'
runtimeOnly 'org.postgresql:postgresql'
// https://mvnrepository.com/artifact/org.testcontainers/testcontainers
testCompile group: 'org.testcontainers', name: 'testcontainers', version: '1.15.0-rc1'
testCompile group: 'org.testcontainers', name: 'postgresql', version: '1.15.0-rc1'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'io.rest-assured:spring-mock-mvc:4.3.1'
testImplementation 'io.rest-assured:rest-assured-common:4.3.1'
testImplementation 'org.springframework.boot:spring-boot-starter-data-jpa'
testCompile group: 'org.modelmapper', name: 'modelmapper', version: '2.3.8'
testImplementation 'com.epam.reportportal:agent-java-junit5:5.0.0-RC-1'
intTestCompile group: 'org.testcontainers', name: 'testcontainers', version: '1.15.0-rc1'
intTestCompile group: 'org.testcontainers', name: 'postgresql', version: '1.15.0-rc1'
intTestImplementation 'org.springframework.boot:spring-boot-starter-test'
intTestImplementation 'io.rest-assured:spring-mock-mvc:4.1.2'
intTestImplementation 'com.epam.reportportal:agent-java-junit5:5.0.0-RC-1'
intTestRuntimeOnly 'org.postgresql:postgresql'
}
test {
// testLogging.showStandardStreams = true
useJUnitPlatform()
// systemProperty 'junit.jupiter.extensions.autodetection.enabled', true
}
task integrationTest(type: Test) {
description = 'Runs integration tests.'
group = 'verification'
testClassesDirs = sourceSets.intTest.output.classesDirs
classpath = sourceSets.intTest.runtimeClasspath
shouldRunAfter test
}
When I run the test for the service I get a nullpointer for repository
TodoServiceTest > shoulCreateTodo() FAILED
java.lang.NullPointerException at TodoServiceTest.java:55
TodoServiceTest > shouldDeleteTodo() FAILED
java.lang.NullPointerException at TodoServiceTest.java:48
package com.steinko.reactsprinboottutorial.RestfulWebService;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Disabled;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
import static org.hamcrest.MatcherAssert.assertThat;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
public class TodoServiceTest {
private static final Logger logger = LoggerFactory.getLogger(TodoServiceTest.class);
private TodoService service = new TodoService();
#Test
void ShouldExist() {
assertNotNull (service);
}
#Test
void shouldDeleteTodo() {
service.deleteTodo("stein", 1L);
}
#Test
void shoulCreateTodo() {
Date date = DateFactory.generetDate("01-01-2020 12:00:00");
TodoDto todo = new TodoDto(1,"Stein","Fix Kjakk", date,false);
service.createTodo(todo);
}
}
The service test looks like
package com.steinko.reactsprinboottutorial.RestfulWebService;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validation;
import javax.validation.Validator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
#Service
public class TodoService {
private static final Logger logger = LoggerFactory.getLogger(TodoService.class);
#Autowired
private TodoRepository repository;
public List<TodoDto> getTodos(String name) {
List<Todo> todos = repository.findByName(name);
TodoConverter converter = new TodoConverter();
List<TodoDto> dtos = converter.convertToDtos(todos);
return dtos;
}
public void deleteTodo(String name, Long id) {
repository.deleteById(id);
}
public void createTodo(TodoDto dto) {
TodoConverter converter = new TodoConverter();
Todo todo = converter.convertToEntity(dto);
validateEntity(todo);
repository.save(todo);
}
private void validateEntity(Todo todo) {
List<String> errorMessage = new ArrayList<>();
Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
Set<ConstraintViolation<Todo>> constraintViolations = validator.validate(todo);
for (ConstraintViolation<Todo> constraintViolation : constraintViolations) {
errorMessage.add(constraintViolation.getMessage());
}
if (errorMessage.size() > 0) {
throw new ConstraintViolationException(constraintViolations);
}
}
}
How do I get access to org.springframework.data and an object at repository variabel ?
You have to annotate the test class with either #SpringBootTest or #DataJpaTest so the repository will be initialised and injected into your service. Furthermore, you have to autowire your service in the test, or the repository will not be injected in the instance created by you.
I am using the firebase admin SDK with IntelliJ whenever I try to run this code I got this error message:
Error:(15, 50) java: cannot access com.google.auth.Credentials
class file for com.google.auth.Credentials not found
this is the code:
import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import java.io.FileInputStream;
import java.io.IOException;
public class main {
public static void main (String args[]) throws IOException {
FileInputStream serviceAccount =
new FileInputStream("C:/Users/fusion/Desktop/projects/aesf/google-services.json");
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials.fromStream(serviceAccount))
.setDatabaseUrl("https://myDataBaseName.firebaseio.com")
.build();
FirebaseApp.initializeApp(options);
}
}
And this is the gradle file:
plugins {
id 'java'
}
version '1.0-SNAPSHOT'
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
implementation 'com.google.firebase:firebase-admin:6.6.0'
implementation 'com.google.auth:google-auth-library-oauth2-http:0.12.0'
}
gradle :
rootProject.name = 'aesf'
Check you are using one of these
remove them
google-oauth-client-1.22.0.jar
google-oauth-client-appengine-1.22.0.jar
google-oauth-client-servlet-1.22.0.jar
also update your classpath
classpath 'com.google.gms:google-services:4.2.0'
I am trying to implement the hello world web application using spring boot, gradle and tomcat by following "Building a RESTful Web Service" but have been unable to run make it run so far.
The code is pretty much the same as the one provided on the website, I have wasted hours debugging it thinking there was a bug in the provided code but I still can't figure out what's wrong.
I am using Eclipse Java EE IDE for Web Developers, Version: Neon.3 Release (4.6.3), Build id: 20170314-1500
Any idea what could be the issue?
build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
bootJar {
baseName = 'gs-rest-service'
version = '0.1.0'
}
repositories {
mavenCentral()
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile('org.springframework.boot:spring-boot-starter-test')
}
Greeting.java
package App;
public class Greeting {
private final long id;
private final String content;
public Greeting(long id, String content) {
this.id = id;
this.content = content;
}
public long getId() {
return id;
}
public String getContent() {
return content;
}
}
GreetingController.java
package App;
import java.util.concurrent.atomic.AtomicLong;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
#RestController
public class GreetingController {
private static final String template = "Hello, %s!";
private final AtomicLong counter = new AtomicLong();
#RequestMapping("/greeting")
public Greeting greeting(#RequestParam(value="name", defaultValue="World") String name) {
return new Greeting(counter.incrementAndGet(),
String.format(template, name));
}
}
Application.java
package App;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class Application {
public static void main(String[] args) {
System.getProperties().put("server.port", 8486);
SpringApplication.run(Application.class, args);
}
}
Stacktrace
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.apache.logging.log4j.util.PropertiesUtil
at org.apache.logging.log4j.status.StatusLogger.<clinit>(StatusLogger.java:71)
at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:60)
at org.apache.commons.logging.LogFactory$Log4jLog.<clinit>(LogFactory.java:199)
at org.apache.commons.logging.LogFactory$Log4jDelegate.createLog(LogFactory.java:166)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:109)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:99)
at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:198)
at App.Application.main(Application.java:9)
When using the authorisation manager, this message can also be the result of a missing grant (or file) in the catalina.policy or security.policy (-Djava.security.policy).
For example add:
grant codeBase "file:${catalina.base}/webapps/${APPLICATION_NAME}/-" {
permission java.security.AllPermission;
};
Apparently setting the port number using System.getProperties().put("server.port", 8486); the NoClassDefFoundError exception.
However creating a application.properties file mentioned by #Nitishkumar Singh in the resources folder to specify the port number to use solved the issue.
Add this dependency:
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.0'
And try again.
Could not initialize class org.apache.logging.log4j.util.PropertiesUtil.
I met the same problem as you. Automated deployment to Tomcat by using Jenkins always occurs. Probably some jar don't exclusion dependecy 'org.apache.logging.log4j'. But springbooot 2.0.1.RELEASE uses logback by default. On org.springframework.boot.web.servlet.support.SpringBootServletInitializer:
public void onStartup(ServletContext servletContext) throws ServletException {
this.logger = LogFactory.getLog(this.getClass());
WebApplicationContext rootAppContext = this.createRootApplicationContext(servletContext);
if (rootAppContext != null) {
servletContext.addListener(new ContextLoaderListener(rootAppContext) {
public void contextInitialized(ServletContextEvent event) {
}
});
} else {
this.logger.debug("No ContextLoaderListener registered, as createRootApplicationContext() did not return an application context");
}
}
public static Log getLog(String name) {
switch(logApi) {
case LOG4J:
return LogFactory.Log4jDelegate.createLog(name);
case SLF4J_LAL:
return LogFactory.Slf4jDelegate.createLocationAwareLog(name);
case SLF4J:
return LogFactory.Slf4jDelegate.createLog(name);
default:
return LogFactory.JavaUtilDelegate.createLog(name);
}
}
I have a controller with the following:
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import javax.validation.Validator;
#RestController
#RequestMapping("/")
public class MyController {
#Autowired
private Validator validator;
//..elided...
#GetMapping
public String getSomething(#Valid #RequestBody MyRequest) {
//This is null
if ( validator == null ) {
throw new Exception("is null");
}
}
}
My configuration class:
package com.app.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
#Configuration
#EnableWebMvc
#ComponentScan("com.app")
public class ValidationConfig {
#Bean
public Validator validator() {
return new LocalValidatorFactoryBean();
}
/* //Including this doesn't help
#Bean
public MethodValidationPostProcessor methodValidationPostProcessor() {
MethodValidationPostProcessor methodValidationPostProcessor = new MethodValidationPostProcessor();
methodValidationPostProcessor.setValidator(validator());
return methodValidationPostProcessor;
}*/
}
Gradle:
buildscript {
ext {
springBootVersion = "1.5.6.RELEASE"
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: "java"
apply plugin: "eclipse"
apply plugin: "org.springframework.boot"
apply plugin: "idea"
apply plugin: "jacoco"
jar {
baseName = "my-service"
version = "0.0.1-SNAPSHOT"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
//Spring Boot
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-actuator")
//Testing
testCompile("org.hamcrest:hamcrest-all:1.3")
testCompile("org.springframework.boot:spring-boot-starter-test")
}
No matter what I do, the validator in my controller is null!
In your controller you are expecting a javax.validation.Validator but in the config you are using org.springframework.validation.Validator