Why is my vaadin button not displaying correctly?How to secure Vaadin flow application with Spring SecurityWhat is reflection and why is it useful?What is a serialVersionUID and why should I use it?Why does Java have transient fields?Why use getters and setters/accessors?Why is subtracting these two times (in 1927) giving a strange result?Why don't Java's +=, -=, *=, /= compound assignment operators require casting?Why is char[] preferred over String for passwords?Why is processing a sorted array faster than processing an unsorted array?Why does this code using random strings print “hello world”?Why is printing “B” dramatically slower than printing “#”?

Double it your way

In Germany, how can I maximize the impact of my charitable donations?

Do I need 3 RGB channels for a spectrogram CNN?

Can I conceal an antihero's insanity - and should I?

Relocation error, error code (127) after last updates

I asked for a graduate student position from a professor. He replied "welcome". What does that mean?

My research paper filed as a patent in China by my Chinese supervisor without me as inventor

What jurisdiction do Scottish courts have over the Westminster parliament?

Why does Coq include let-expressions in its core language

Is there a reliable way to hide/convey a message in vocal expressions (speech, song,...)

Why should I always enable compiler warnings?

Resume: How to quantify my contributions as a software engineer?

Why did they ever make smaller than full-frame sensors?

Is it appropriate for a professor to require students to sign a non-disclosure agreement before being taught?

How to run Death House for 3 new players with no healer?

How can I fix a framing mistake so I can drywall?

Can I toggle Do Not Disturb on/off on my Mac as easily as I can on my iPhone?

Does a gnoll speak both Gnoll and Abyssal, or is Gnoll a dialect of Abyssal?

Mean π: Archimedes vs. Gauss - π computation through generalized means

Do all humans have an identical nucleotide sequence for certain proteins, e.g haemoglobin?

How can I locate a missing person abroad?

Why do sellers care about down payments?

How do email clients "send later" without storing a password?

Is English tonal for some words, like "permit"?



Why is my vaadin button not displaying correctly?


How to secure Vaadin flow application with Spring SecurityWhat is reflection and why is it useful?What is a serialVersionUID and why should I use it?Why does Java have transient fields?Why use getters and setters/accessors?Why is subtracting these two times (in 1927) giving a strange result?Why don't Java's +=, -=, *=, /= compound assignment operators require casting?Why is char[] preferred over String for passwords?Why is processing a sorted array faster than processing an unsorted array?Why does this code using random strings print “hello world”?Why is printing “B” dramatically slower than printing “#”?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















Pretty much the title ,i've looked everywhere for an answer but i either missed something in setup, spring did, gradle f'ed up or i cant read.



I think my page should be a nice blue button or something (i know i deleted grid), i followed https://www.baeldung.com/spring-boot-vaadin but instead im getting this, here's my build.gradle and the relevant code:



build.gradle:



plugins 
id 'org.jetbrains.kotlin.plugin.jpa' version '1.3.21'
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'org.jetbrains.kotlin.jvm' version '1.3.21'
id 'org.jetbrains.kotlin.plugin.spring' version '1.3.21'
id 'com.devsoap.vaadin-flow' version '1.0'
//id 'org.gretty' version '2.3.1'
id 'java'
// solves the problem with long classpath using JAR instead of classpath on command line
id "ua.eshepelyuk.ManifestClasspath" version "1.0.0"


vaadin
version '12.0.0'


apply plugin: 'io.spring.dependency-management'

version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations
compileOnly
extendsFrom annotationProcessor



springBoot
mainClassName = "com.cpsc471.TheatreManagmentApplicationKt"


repositories
mavenCentral()
maven url "https://maven.vaadin.com/vaadin-addons"
vaadin.repositories()
// Add the pre-release repository
vaadin.prereleases()
// Add the snapshot repository
vaadin.snapshots()
// Add the addons repository
vaadin.addons()


ext
set('vaadinVersion', '13.0.1')


noArg
annotation("MappedSuperclass")


dependencies
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-tomcat'
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'com.vaadin:vaadin-spring-boot-starter:13.0.2'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'org.springframework.retry:spring-retry'

implementation 'com.h2database:h2'

implementation vaadin.bom()
implementation vaadin.platform()
implementation vaadin.lumoTheme()
compile vaadin.springBoot()

compileOnly 'org.projectlombok:lombok'

runtimeOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'

annotationProcessor 'org.projectlombok:lombok'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'


dependencyManagement
imports
mavenBom "com.vaadin:vaadin-bom:$vaadinVersion"



compileKotlin
kotlinOptions
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'



compileTestKotlin
kotlinOptions
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'




MainView:



import com.cpsc471.model.types.User;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.value.ValueChangeMode;
import com.vaadin.flow.router.Route;

@Route(value = "test")
public class MainView extends VerticalLayout

private EmployeeEditor editor;
private TextField filter;
private Button addNewBtn;

public MainView (EmployeeEditor editor)
setSizeFull();
this.editor = editor;
this.filter = new TextField();
this.addNewBtn = new Button("New employee", VaadinIcon.PLUS.create());

HorizontalLayout actions = new HorizontalLayout(filter, addNewBtn);
add(actions, editor);

filter.setPlaceholder("Filter by last name");
filter.setValueChangeMode(ValueChangeMode.EAGER);




Custom component:



package com.cpsc471.model;

import com.cpsc471.model.types.User;
import com.vaadin.flow.component.KeyNotifier;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.binder.Binder;
import com.vaadin.flow.spring.annotation.SpringComponent;
import com.vaadin.flow.spring.annotation.UIScope;

import javax.swing.plaf.basic.BasicMenuUI;

@SpringComponent
@UIScope
public class EmployeeEditor extends VerticalLayout implements KeyNotifier
private User employee;

private TextField firstName = new TextField("First name");
private TextField lastName = new TextField("Last name");

private Button save = new Button("Save", VaadinIcon.CHECK.create());
private Button cancel = new Button("Cancel");
private Button delete = new Button("Delete", VaadinIcon.TRASH.create());

private HorizontalLayout actions = new HorizontalLayout(save, cancel, delete);
private Binder<User> binder = new Binder<>(User.class);
private BasicMenuUI.ChangeHandler changeHandler;



spring boot application (kotlin):



import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.context.annotation .Bean
import org.springframework.context.annotation .Configuration
import org.springframework.security.config.annotation .web.builders.HttpSecurity
import org.springframework.security.config.annotation .web.configuration.EnableWebSecurity
import org.springframework.security.config.annotation .web.configuration.WebSecurityConfigurerAdapter
import org.springframework.security.core.userdetails.User
import org.springframework.security.core.userdetails.UserDetailsService
import org.springframework.security.provisioning.InMemoryUserDetailsManager
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

import org.springframework.boot.SpringApplication
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer

@SpringBootApplication
class TheatreManagmentApplication : SpringBootServletInitializer()

fun main(args: Array<String>)
SpringApplication.run(TheatreManagmentApplication::class.java, *args)


@Configuration
@EnableWebSecurity
class WebSecurityConfig : WebSecurityConfigurerAdapter()
@Throws(Exception::class)
protected override fun configure(http: HttpSecurity)
http
.authorizeRequests()
.antMatchers("/", "/home","/h2/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll()

http.csrf().disable()
http.headers().frameOptions().disable()


@Bean
override fun userDetailsService(): UserDetailsService
val user = User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build()

return InMemoryUserDetailsManager(user)



@Configuration
class MvcConfig : WebMvcConfigurer
override fun addViewControllers(registry: ViewControllerRegistry)
registry.addViewController("/home").setViewName("home")
registry.addViewController("/").setViewName("home")
registry.addViewController("/hello").setViewName("hello")
registry.addViewController("/login").setViewName("login")











share|improve this question


























  • Are you sure all HTTP request are made without error? Have a look in your browser development tools whether all requests to resources (HTML, CSS, scripts) were successful response 200. I guess the Spring security configuration is not sufficient but I didn't try it out. Check this.

    – Steffen Harbich
    Apr 1 at 17:24

















2















Pretty much the title ,i've looked everywhere for an answer but i either missed something in setup, spring did, gradle f'ed up or i cant read.



I think my page should be a nice blue button or something (i know i deleted grid), i followed https://www.baeldung.com/spring-boot-vaadin but instead im getting this, here's my build.gradle and the relevant code:



build.gradle:



plugins 
id 'org.jetbrains.kotlin.plugin.jpa' version '1.3.21'
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'org.jetbrains.kotlin.jvm' version '1.3.21'
id 'org.jetbrains.kotlin.plugin.spring' version '1.3.21'
id 'com.devsoap.vaadin-flow' version '1.0'
//id 'org.gretty' version '2.3.1'
id 'java'
// solves the problem with long classpath using JAR instead of classpath on command line
id "ua.eshepelyuk.ManifestClasspath" version "1.0.0"


vaadin
version '12.0.0'


apply plugin: 'io.spring.dependency-management'

version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations
compileOnly
extendsFrom annotationProcessor



springBoot
mainClassName = "com.cpsc471.TheatreManagmentApplicationKt"


repositories
mavenCentral()
maven url "https://maven.vaadin.com/vaadin-addons"
vaadin.repositories()
// Add the pre-release repository
vaadin.prereleases()
// Add the snapshot repository
vaadin.snapshots()
// Add the addons repository
vaadin.addons()


ext
set('vaadinVersion', '13.0.1')


noArg
annotation("MappedSuperclass")


dependencies
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-tomcat'
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'com.vaadin:vaadin-spring-boot-starter:13.0.2'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'org.springframework.retry:spring-retry'

implementation 'com.h2database:h2'

implementation vaadin.bom()
implementation vaadin.platform()
implementation vaadin.lumoTheme()
compile vaadin.springBoot()

compileOnly 'org.projectlombok:lombok'

runtimeOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'

annotationProcessor 'org.projectlombok:lombok'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'


dependencyManagement
imports
mavenBom "com.vaadin:vaadin-bom:$vaadinVersion"



compileKotlin
kotlinOptions
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'



compileTestKotlin
kotlinOptions
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'




MainView:



import com.cpsc471.model.types.User;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.value.ValueChangeMode;
import com.vaadin.flow.router.Route;

@Route(value = "test")
public class MainView extends VerticalLayout

private EmployeeEditor editor;
private TextField filter;
private Button addNewBtn;

public MainView (EmployeeEditor editor)
setSizeFull();
this.editor = editor;
this.filter = new TextField();
this.addNewBtn = new Button("New employee", VaadinIcon.PLUS.create());

HorizontalLayout actions = new HorizontalLayout(filter, addNewBtn);
add(actions, editor);

filter.setPlaceholder("Filter by last name");
filter.setValueChangeMode(ValueChangeMode.EAGER);




Custom component:



package com.cpsc471.model;

import com.cpsc471.model.types.User;
import com.vaadin.flow.component.KeyNotifier;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.binder.Binder;
import com.vaadin.flow.spring.annotation.SpringComponent;
import com.vaadin.flow.spring.annotation.UIScope;

import javax.swing.plaf.basic.BasicMenuUI;

@SpringComponent
@UIScope
public class EmployeeEditor extends VerticalLayout implements KeyNotifier
private User employee;

private TextField firstName = new TextField("First name");
private TextField lastName = new TextField("Last name");

private Button save = new Button("Save", VaadinIcon.CHECK.create());
private Button cancel = new Button("Cancel");
private Button delete = new Button("Delete", VaadinIcon.TRASH.create());

private HorizontalLayout actions = new HorizontalLayout(save, cancel, delete);
private Binder<User> binder = new Binder<>(User.class);
private BasicMenuUI.ChangeHandler changeHandler;



spring boot application (kotlin):



import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.context.annotation .Bean
import org.springframework.context.annotation .Configuration
import org.springframework.security.config.annotation .web.builders.HttpSecurity
import org.springframework.security.config.annotation .web.configuration.EnableWebSecurity
import org.springframework.security.config.annotation .web.configuration.WebSecurityConfigurerAdapter
import org.springframework.security.core.userdetails.User
import org.springframework.security.core.userdetails.UserDetailsService
import org.springframework.security.provisioning.InMemoryUserDetailsManager
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

import org.springframework.boot.SpringApplication
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer

@SpringBootApplication
class TheatreManagmentApplication : SpringBootServletInitializer()

fun main(args: Array<String>)
SpringApplication.run(TheatreManagmentApplication::class.java, *args)


@Configuration
@EnableWebSecurity
class WebSecurityConfig : WebSecurityConfigurerAdapter()
@Throws(Exception::class)
protected override fun configure(http: HttpSecurity)
http
.authorizeRequests()
.antMatchers("/", "/home","/h2/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll()

http.csrf().disable()
http.headers().frameOptions().disable()


@Bean
override fun userDetailsService(): UserDetailsService
val user = User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build()

return InMemoryUserDetailsManager(user)



@Configuration
class MvcConfig : WebMvcConfigurer
override fun addViewControllers(registry: ViewControllerRegistry)
registry.addViewController("/home").setViewName("home")
registry.addViewController("/").setViewName("home")
registry.addViewController("/hello").setViewName("hello")
registry.addViewController("/login").setViewName("login")











share|improve this question


























  • Are you sure all HTTP request are made without error? Have a look in your browser development tools whether all requests to resources (HTML, CSS, scripts) were successful response 200. I guess the Spring security configuration is not sufficient but I didn't try it out. Check this.

    – Steffen Harbich
    Apr 1 at 17:24













2












2








2








Pretty much the title ,i've looked everywhere for an answer but i either missed something in setup, spring did, gradle f'ed up or i cant read.



I think my page should be a nice blue button or something (i know i deleted grid), i followed https://www.baeldung.com/spring-boot-vaadin but instead im getting this, here's my build.gradle and the relevant code:



build.gradle:



plugins 
id 'org.jetbrains.kotlin.plugin.jpa' version '1.3.21'
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'org.jetbrains.kotlin.jvm' version '1.3.21'
id 'org.jetbrains.kotlin.plugin.spring' version '1.3.21'
id 'com.devsoap.vaadin-flow' version '1.0'
//id 'org.gretty' version '2.3.1'
id 'java'
// solves the problem with long classpath using JAR instead of classpath on command line
id "ua.eshepelyuk.ManifestClasspath" version "1.0.0"


vaadin
version '12.0.0'


apply plugin: 'io.spring.dependency-management'

version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations
compileOnly
extendsFrom annotationProcessor



springBoot
mainClassName = "com.cpsc471.TheatreManagmentApplicationKt"


repositories
mavenCentral()
maven url "https://maven.vaadin.com/vaadin-addons"
vaadin.repositories()
// Add the pre-release repository
vaadin.prereleases()
// Add the snapshot repository
vaadin.snapshots()
// Add the addons repository
vaadin.addons()


ext
set('vaadinVersion', '13.0.1')


noArg
annotation("MappedSuperclass")


dependencies
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-tomcat'
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'com.vaadin:vaadin-spring-boot-starter:13.0.2'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'org.springframework.retry:spring-retry'

implementation 'com.h2database:h2'

implementation vaadin.bom()
implementation vaadin.platform()
implementation vaadin.lumoTheme()
compile vaadin.springBoot()

compileOnly 'org.projectlombok:lombok'

runtimeOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'

annotationProcessor 'org.projectlombok:lombok'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'


dependencyManagement
imports
mavenBom "com.vaadin:vaadin-bom:$vaadinVersion"



compileKotlin
kotlinOptions
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'



compileTestKotlin
kotlinOptions
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'




MainView:



import com.cpsc471.model.types.User;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.value.ValueChangeMode;
import com.vaadin.flow.router.Route;

@Route(value = "test")
public class MainView extends VerticalLayout

private EmployeeEditor editor;
private TextField filter;
private Button addNewBtn;

public MainView (EmployeeEditor editor)
setSizeFull();
this.editor = editor;
this.filter = new TextField();
this.addNewBtn = new Button("New employee", VaadinIcon.PLUS.create());

HorizontalLayout actions = new HorizontalLayout(filter, addNewBtn);
add(actions, editor);

filter.setPlaceholder("Filter by last name");
filter.setValueChangeMode(ValueChangeMode.EAGER);




Custom component:



package com.cpsc471.model;

import com.cpsc471.model.types.User;
import com.vaadin.flow.component.KeyNotifier;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.binder.Binder;
import com.vaadin.flow.spring.annotation.SpringComponent;
import com.vaadin.flow.spring.annotation.UIScope;

import javax.swing.plaf.basic.BasicMenuUI;

@SpringComponent
@UIScope
public class EmployeeEditor extends VerticalLayout implements KeyNotifier
private User employee;

private TextField firstName = new TextField("First name");
private TextField lastName = new TextField("Last name");

private Button save = new Button("Save", VaadinIcon.CHECK.create());
private Button cancel = new Button("Cancel");
private Button delete = new Button("Delete", VaadinIcon.TRASH.create());

private HorizontalLayout actions = new HorizontalLayout(save, cancel, delete);
private Binder<User> binder = new Binder<>(User.class);
private BasicMenuUI.ChangeHandler changeHandler;



spring boot application (kotlin):



import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.context.annotation .Bean
import org.springframework.context.annotation .Configuration
import org.springframework.security.config.annotation .web.builders.HttpSecurity
import org.springframework.security.config.annotation .web.configuration.EnableWebSecurity
import org.springframework.security.config.annotation .web.configuration.WebSecurityConfigurerAdapter
import org.springframework.security.core.userdetails.User
import org.springframework.security.core.userdetails.UserDetailsService
import org.springframework.security.provisioning.InMemoryUserDetailsManager
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

import org.springframework.boot.SpringApplication
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer

@SpringBootApplication
class TheatreManagmentApplication : SpringBootServletInitializer()

fun main(args: Array<String>)
SpringApplication.run(TheatreManagmentApplication::class.java, *args)


@Configuration
@EnableWebSecurity
class WebSecurityConfig : WebSecurityConfigurerAdapter()
@Throws(Exception::class)
protected override fun configure(http: HttpSecurity)
http
.authorizeRequests()
.antMatchers("/", "/home","/h2/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll()

http.csrf().disable()
http.headers().frameOptions().disable()


@Bean
override fun userDetailsService(): UserDetailsService
val user = User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build()

return InMemoryUserDetailsManager(user)



@Configuration
class MvcConfig : WebMvcConfigurer
override fun addViewControllers(registry: ViewControllerRegistry)
registry.addViewController("/home").setViewName("home")
registry.addViewController("/").setViewName("home")
registry.addViewController("/hello").setViewName("hello")
registry.addViewController("/login").setViewName("login")











share|improve this question
















Pretty much the title ,i've looked everywhere for an answer but i either missed something in setup, spring did, gradle f'ed up or i cant read.



I think my page should be a nice blue button or something (i know i deleted grid), i followed https://www.baeldung.com/spring-boot-vaadin but instead im getting this, here's my build.gradle and the relevant code:



build.gradle:



plugins 
id 'org.jetbrains.kotlin.plugin.jpa' version '1.3.21'
id 'org.springframework.boot' version '2.1.3.RELEASE'
id 'org.jetbrains.kotlin.jvm' version '1.3.21'
id 'org.jetbrains.kotlin.plugin.spring' version '1.3.21'
id 'com.devsoap.vaadin-flow' version '1.0'
//id 'org.gretty' version '2.3.1'
id 'java'
// solves the problem with long classpath using JAR instead of classpath on command line
id "ua.eshepelyuk.ManifestClasspath" version "1.0.0"


vaadin
version '12.0.0'


apply plugin: 'io.spring.dependency-management'

version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

configurations
compileOnly
extendsFrom annotationProcessor



springBoot
mainClassName = "com.cpsc471.TheatreManagmentApplicationKt"


repositories
mavenCentral()
maven url "https://maven.vaadin.com/vaadin-addons"
vaadin.repositories()
// Add the pre-release repository
vaadin.prereleases()
// Add the snapshot repository
vaadin.snapshots()
// Add the addons repository
vaadin.addons()


ext
set('vaadinVersion', '13.0.1')


noArg
annotation("MappedSuperclass")


dependencies
implementation 'org.springframework.boot:spring-boot-starter-cache'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
implementation 'org.springframework.boot:spring-boot-starter-mail'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-tomcat'
implementation "org.springframework.boot:spring-boot-starter-data-jpa"
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
implementation 'com.vaadin:vaadin-spring-boot-starter:13.0.2'
implementation 'org.jetbrains.kotlin:kotlin-reflect'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
implementation 'org.springframework.retry:spring-retry'

implementation 'com.h2database:h2'

implementation vaadin.bom()
implementation vaadin.platform()
implementation vaadin.lumoTheme()
compile vaadin.springBoot()

compileOnly 'org.projectlombok:lombok'

runtimeOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'

annotationProcessor 'org.projectlombok:lombok'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'


dependencyManagement
imports
mavenBom "com.vaadin:vaadin-bom:$vaadinVersion"



compileKotlin
kotlinOptions
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'



compileTestKotlin
kotlinOptions
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'




MainView:



import com.cpsc471.model.types.User;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.grid.Grid;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.value.ValueChangeMode;
import com.vaadin.flow.router.Route;

@Route(value = "test")
public class MainView extends VerticalLayout

private EmployeeEditor editor;
private TextField filter;
private Button addNewBtn;

public MainView (EmployeeEditor editor)
setSizeFull();
this.editor = editor;
this.filter = new TextField();
this.addNewBtn = new Button("New employee", VaadinIcon.PLUS.create());

HorizontalLayout actions = new HorizontalLayout(filter, addNewBtn);
add(actions, editor);

filter.setPlaceholder("Filter by last name");
filter.setValueChangeMode(ValueChangeMode.EAGER);




Custom component:



package com.cpsc471.model;

import com.cpsc471.model.types.User;
import com.vaadin.flow.component.KeyNotifier;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.data.binder.Binder;
import com.vaadin.flow.spring.annotation.SpringComponent;
import com.vaadin.flow.spring.annotation.UIScope;

import javax.swing.plaf.basic.BasicMenuUI;

@SpringComponent
@UIScope
public class EmployeeEditor extends VerticalLayout implements KeyNotifier
private User employee;

private TextField firstName = new TextField("First name");
private TextField lastName = new TextField("Last name");

private Button save = new Button("Save", VaadinIcon.CHECK.create());
private Button cancel = new Button("Cancel");
private Button delete = new Button("Delete", VaadinIcon.TRASH.create());

private HorizontalLayout actions = new HorizontalLayout(save, cancel, delete);
private Binder<User> binder = new Binder<>(User.class);
private BasicMenuUI.ChangeHandler changeHandler;



spring boot application (kotlin):



import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.context.annotation .Bean
import org.springframework.context.annotation .Configuration
import org.springframework.security.config.annotation .web.builders.HttpSecurity
import org.springframework.security.config.annotation .web.configuration.EnableWebSecurity
import org.springframework.security.config.annotation .web.configuration.WebSecurityConfigurerAdapter
import org.springframework.security.core.userdetails.User
import org.springframework.security.core.userdetails.UserDetailsService
import org.springframework.security.provisioning.InMemoryUserDetailsManager
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

import org.springframework.boot.SpringApplication
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer

@SpringBootApplication
class TheatreManagmentApplication : SpringBootServletInitializer()

fun main(args: Array<String>)
SpringApplication.run(TheatreManagmentApplication::class.java, *args)


@Configuration
@EnableWebSecurity
class WebSecurityConfig : WebSecurityConfigurerAdapter()
@Throws(Exception::class)
protected override fun configure(http: HttpSecurity)
http
.authorizeRequests()
.antMatchers("/", "/home","/h2/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.permitAll()
.and()
.logout()
.permitAll()

http.csrf().disable()
http.headers().frameOptions().disable()


@Bean
override fun userDetailsService(): UserDetailsService
val user = User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build()

return InMemoryUserDetailsManager(user)



@Configuration
class MvcConfig : WebMvcConfigurer
override fun addViewControllers(registry: ViewControllerRegistry)
registry.addViewController("/home").setViewName("home")
registry.addViewController("/").setViewName("home")
registry.addViewController("/hello").setViewName("hello")
registry.addViewController("/login").setViewName("login")








java spring-boot kotlin vaadin vaadin-flow






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 9:24









VLAZ

7,9775 gold badges25 silver badges38 bronze badges




7,9775 gold badges25 silver badges38 bronze badges










asked Mar 28 at 8:07









sonicskatersonicskater

113 bronze badges




113 bronze badges















  • Are you sure all HTTP request are made without error? Have a look in your browser development tools whether all requests to resources (HTML, CSS, scripts) were successful response 200. I guess the Spring security configuration is not sufficient but I didn't try it out. Check this.

    – Steffen Harbich
    Apr 1 at 17:24

















  • Are you sure all HTTP request are made without error? Have a look in your browser development tools whether all requests to resources (HTML, CSS, scripts) were successful response 200. I guess the Spring security configuration is not sufficient but I didn't try it out. Check this.

    – Steffen Harbich
    Apr 1 at 17:24
















Are you sure all HTTP request are made without error? Have a look in your browser development tools whether all requests to resources (HTML, CSS, scripts) were successful response 200. I guess the Spring security configuration is not sufficient but I didn't try it out. Check this.

– Steffen Harbich
Apr 1 at 17:24





Are you sure all HTTP request are made without error? Have a look in your browser development tools whether all requests to resources (HTML, CSS, scripts) were successful response 200. I guess the Spring security configuration is not sufficient but I didn't try it out. Check this.

– Steffen Harbich
Apr 1 at 17:24












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);














draft saved

draft discarded
















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55392750%2fwhy-is-my-vaadin-button-not-displaying-correctly%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.




















draft saved

draft discarded















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55392750%2fwhy-is-my-vaadin-button-not-displaying-correctly%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript