melihat bean yang diload pada spring boot

bean apa saja yang diload ketika spring boot dijalankan

Bismillah


package com.saifiahmada.spring;

import java.util.Arrays;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.ApplicationContext;

@Configurable
@EnableAutoConfiguration
public class OfflineTest {

public static void main(String [] args){
ApplicationContext ctx = SpringApplication.run(OfflineTest.class, args);

System.out.println("List beans pada Spring Boot adalah :");

String[] beanNames = ctx.getBeanDefinitionNames();
Arrays.sort(beanNames);
for (String beanName : beanNames) {
System.out.println(beanName);
}
}
}

q> Hasilnya adalah :

List beans pada Spring Boot adalah :
$autoCreateChannelCandidates
DefaultConfiguringBeanFactoryPostProcessor
IntegrationConfigurationBeanFactoryPostProcessor
_org.springframework.integration.errorLogger
authenticationEventPublisher
authenticationManager
authenticationManagerBuilder
autowiredWebSecurityConfigurersIgnoreParents
bankSoalRepository
basicErrorController
beanNameHandlerMapping
beanNameViewResolver
bootDefaultingAuthenticationConfigurerAdapter
bootGlobalAuthenticationConfigurationAdapter
channelInitializer
characterEncodingFilter
converterRegistrar
dataSource
dataSourceInitializedPublisher
dataSourceInitializer
dataSourceInitializerPostProcessor
datatypeChannelMessageConverter
defaultServletHandlerMapping
defaultTemplateResolver
defaultViewResolver
delegatingApplicationListener
dispatcherServlet
dispatcherServletRegistration
embeddedServletContainerCustomizerBeanPostProcessor
enableGlobalAuthenticationAutowiredConfigurer
entityManagerFactory
entityManagerFactoryBuilder
error
errorAttributes
errorChannel
faviconHandlerMapping
faviconRequestHandler
foo
globalChannelInterceptorProcessor
handlerExceptionResolver
hdrTestRepository
hiddenHttpMethodFilter
http.mappers.CONFIGURATION_PROPERTIES
httpRequestHandlerAdapter
ignoredPathsWebSecurityConfigurerAdapter
integrationConversionService
integrationEvaluationContext
integrationGlobalProperties
integrationHeaderChannelRegistry
integrationRequestMappingHandlerMapping
jacksonGeoModule
jacksonObjectMapper
jacksonObjectMapperBuilder
jdbcTemplate
jpaMappingContext
jpaVendorAdapter
kontakRepository
layoutDialect
mappingJackson2HttpMessageConverter
mbeanExporter
mbeanServer
messageBuilderFactory
messageConverters
multipart.CONFIGURATION_PROPERTIES
multipartConfigElement
multipartResolver
mvcContentNegotiationManager
mvcConversionService
mvcPathMatcher
mvcResourceUrlProvider
mvcUriComponentsContributor
mvcUrlPathHelper
mvcValidator
mvcViewResolver
namedParameterJdbcTemplate
nullChannel
objectNamingStrategy
objectPostProcessor
offlineTest
openEntityManagerInViewInterceptor
org.springframework.aop.config.internalAutoProxyCreator
org.springframework.boot.autoconfigure.AutoConfigurationPackages
org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration
org.springframework.boot.autoconfigure.aop.AopAutoConfiguration
org.springframework.boot.autoconfigure.aop.AopAutoConfiguration$JdkDynamicAutoProxyConfiguration
org.springframework.boot.autoconfigure.condition.BeanTypeRegistry
org.springframework.boot.autoconfigure.dao.PersistenceExceptionTranslationAutoConfiguration
org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration
org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration
org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration$IntegrationConfiguration
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration
org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$DataSourceInitializerConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$JdbcTemplateConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration
org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration$TransactionManagementConfiguration
org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration
org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$TomcatDataSourcePoolMetadataProviderConfiguration
org.springframework.boot.autoconfigure.jmx.JmxAutoConfiguration
org.springframework.boot.autoconfigure.jta.JtaAutoConfiguration
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration$JpaWebConfiguration
org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration$JpaWebConfiguration$JpaWebMvcConfiguration
org.springframework.boot.autoconfigure.security.AuthenticationManagerConfiguration
org.springframework.boot.autoconfigure.security.AuthenticationManagerConfiguration$AuthenticationManagerConfigurationListener
org.springframework.boot.autoconfigure.security.BootGlobalAuthenticationConfiguration
org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration
org.springframework.boot.autoconfigure.security.SpringBootWebSecurityConfiguration
org.springframework.boot.autoconfigure.security.SpringBootWebSecurityConfiguration$ApplicationNoWebSecurityConfigurerAdapter
org.springframework.boot.autoconfigure.security.SpringBootWebSecurityConfiguration$WebMvcSecurityConfigurationConditions
org.springframework.boot.autoconfigure.security.SpringBootWebSecurityConfiguration$WebMvcSecurityConfigurationConditions$DefaultWebMvcSecurityConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$DefaultTemplateResolverConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafDefaultConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafSecurityDialectConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafViewResolverConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafWebLayoutConfiguration
org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration
org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration$DispatcherServletConfiguration
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration
org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat
org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration
org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration
org.springframework.boot.autoconfigure.web.GsonHttpMessageConvertersConfiguration
org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration
org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration
org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfiguration
org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration
org.springframework.boot.autoconfigure.web.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration
org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration
org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter$FaviconConfiguration
org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration
org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration$TomcatWebSocketConfiguration
org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor
org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.store
org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor
org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor
org.springframework.context.annotation.internalAutowiredAnnotationProcessor
org.springframework.context.annotation.internalCommonAnnotationProcessor
org.springframework.context.annotation.internalConfigurationAnnotationProcessor
org.springframework.context.annotation.internalPersistenceAnnotationProcessor
org.springframework.context.annotation.internalRequiredAnnotationProcessor
org.springframework.data.repository.core.support.RepositoryInterfaceAwareBeanPostProcessor
org.springframework.data.web.config.SpringDataJacksonConfiguration
org.springframework.data.web.config.SpringDataWebConfiguration
org.springframework.integration.config.IdGeneratorConfigurer#0
org.springframework.integration.expression.IntegrationEvaluationContextAwareBeanPostProcessor#0
org.springframework.integration.internalMessagingAnnotationPostProcessor
org.springframework.orm.jpa.SharedEntityManagerCreator#0
org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration
org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration
org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration
org.springframework.security.config.annotation.web.servlet.configuration.WebMvcSecurityConfiguration
org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration
org.springframework.transaction.config.internalTransactionAdvisor
pageableResolver
persistenceExceptionTranslationPostProcessor
privilegeEvaluator
propertySourcesPlaceholderConfigurer
requestContextListener
requestDataValueProcessor
requestMappingHandlerAdapter
requestMappingHandlerMapping
resourceHandlerMapping
roleRepository
runnumRepository
securityDialect
securityFilterChainRegistration
securityProperties
serverProperties
simpleControllerHandlerAdapter
sortResolver
spring.datasource.CONFIGURATION_PROPERTIES
spring.http.encoding.CONFIGURATION_PROPERTIES
spring.jackson.CONFIGURATION_PROPERTIES
spring.jpa.CONFIGURATION_PROPERTIES
spring.jta.CONFIGURATION_PROPERTIES
spring.mvc.CONFIGURATION_PROPERTIES
spring.resources.CONFIGURATION_PROPERTIES
spring.thymeleaf.CONFIGURATION_PROPERTIES
springSecurityFilterChain
stringHttpMessageConverter
taskScheduler
tempRepository
templateEngine
thymeleafResourceResolver
thymeleafViewResolver
toStringFriendlyJsonNodeToStringConverter
tomcatEmbeddedServletContainerFactory
tomcatPoolDataSourceMetadataProvider
transactionAttributeSource
transactionInterceptor
transactionManager
userRepository
viewControllerHandlerMapping
viewResolver
webSecurityExpressionHandler
websocketContainerCustomizer

Alhamdulillah

Advertisements

install code completion thymeleaf on eclipse

Eclipse sts kq ga jalan code completionnya untuk thymeleaf ?

Bismillah

q> Buka eclipse (STS) > Help > Install New Software >

Add > http://www.thymeleaf.org/eclipse-plugin-update-site/

q> Kemudian install > Restart Eclipse (STS)

q> Coba code completion , ketika th: kemudian ctrl + space

Alhamdulillah

@Secured pada controller spring boot

Bagaiamana sebuah controller pada aplikasi spring boot hanya bisa diakases oleh user yang mempunyai ROLE admin ?

Bismillah

misalnya kita mempunyai sebuah controller seperti ini :

@Controller
@RequestMapping("/kontak")
@Secured("ROLE_ADMIN")
public class KontakController {
@RequestMapping("/save")
public void save(){
}
}

Maka untuk mengakses controller tersebut hanya user-user yang mempunyai role admin saja yang bisa mengaksesnya, selain user tersebut maka akan muncul error Access is denied

Catatan :
aplikasi menggunakan spring boot, spring data jpa, spring security, thymeleaf dan database mariadb

Alhamdulillah

copy aplikasi web menjadi html full css js image

Saya bikin aplikasi menggunakan spring boot dan jika dijadikan jar ukurannya file jar sekitar 36 MB, tetapi ketika client mau lihat aplikasi yang sudah saya buat, kebetulan client berada pada daerah yang minim koneksi internet, cari solusi dulu

Bismillah

q> gogling ketemu sumber ini [1]

q> aplikasi spring boot ini diakses menggunakan alamat localhost:8787

q> langsung saja, perintahnya menggunakan perintah ini :

wget --limit-rate=200k --no-clobber --convert-links --random-wait -r -p -E -e robots=off -U mozilla http://localhost:8787

Selection_754

q> Hasil tampilan folder :

Selection_755

q> Klo di-zip menghasilkan 389 Kb, tinggal kirim ke client dan tinggal buka index.html

q> Selesai 🙂
Alhamdulillah

sumber:
[1] http://www.kossboss.com/linux—wget-full-website