Substitute for TemplateResolver in 3.0.0 version of thymeleaf - thymeleaf

I have substituted Thymeleaf 3.0.0 from 2.1.6 version while doing refactoring because of which TemplateResolver and IResourceResolver cannot be resolved to a type.It is deprecated in 3.0.0 version .Can anyone tell me what is the substitute for TemplateResolver in 3.0.0 version.I am not using spring

For what purpose? My Thymeleaf 3.0 template resolver creation looks like this.
#Bean
public ITemplateResolver getTemplateResolver() {
SpringResourceTemplateResolver resolver = new SpringResourceTemplateResolver();
// ...
// configuration
// ...
return resolver;
}

Just swap TemplateResolver for SpringResourceTemplateResolver.

Related

How to convert swagger.json to openapi3 spec

I'm looking for a solution of converting swagger.json (generated by swagger2) to openapi3 json file in my CI/CD process (Git Actions).
I'm doing my job with Java, and I found some ways like:
Swagger inspector -> I guess it works in web env only.
SwaggerHub gradle plugin
Swagger codegen
but I have no experience of my task. which one is proper way to solve my problem? or is there any other way?
grateful for reading my question :)
Renew) I solved it completely, with using Swagger-parser
https://github.com/swagger-api/swagger-parser
example code is here:
#Test
public void parsingTest() throws Exception {
String outputDir = System.getProperty(YOUR_PATH_HERE);
SwaggerParseResult result = new OpenAPIParser().readLocation(YOUR_PATH_HERE, null, null);
OpenAPI api = result.getOpenAPI();
// POJO -> JSON
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.writeValue(new File(YOUR_PATH_HERE), api);
}
hope it makes helpful someone!

What is the getLoggerRepository() method equivalent in 2.x

we are currently using 1.x and have the following in the code
import org.apache.log4j.Logger;
Logger rLogger = Logger.getRootLogger();
Logger fileWriter = rLogger.getLoggerRepository().exists("name");
we are working on upgrading log4j to version 2.x and it looks like getLoggerRepository() is not supported in 2.x.
looking for some help for equivalent code/methods to use in 2.x.
greatly appreciate any help!

Versions of plugins + jars at runtime Grails

Is it possible to find out what versions of the various plugins that are in my war / class loader at runtime? The reason I want to do this so that I can be 100% sure at runtime what version of what is in production.
I see a mechanism in this thread: Obtain Grails plugin version at runtime
But was wondering how I would get this in a GSP? Also, this does not give me the jar versions. Thanks
Can't get it for jars but to display in GSP, do...
controller:
class MetaController {
def pluginManager
def plugins
def index() {
log.debug(">>index()")
// retrieve them all...
plugins = pluginManager.allPlugins.collect { plugin ->
log.debug("Plugin: ${plugin.name}, Version: ${plugin.version}")
return "Plugin: ${plugin.name}, Version: ${plugin.version}"
}
plugins.sort()
[plugins: plugins]
}
}
View...
...
<g:each in="${plugins}" var="p">
<li>${p}</li>
</g:each>

How to configure Apache MyFaces CODI with JBoss AS 7 and Mojarra 2.1?

I have Apache CODI for JSF 2 installed and working. I would like to change "isUrlParameterSupported" to be false, instead of the default true.
Switching my projects to OpenWebBeans is not possible at this time. I am not currently using MyFaces itself, just the CODI extension.
I am using the following jars:
myfaces-extcdi-core-api-1.0.5.jar
myfaces-extcdi-core-impl-1.0.5.jar
myfaces-extcdi-jsf20-module-api-1.0.5.jar
myfaces-extcdi-jsf20-module-impl-1.0.5.jar
myfaces-extcdi-message-module-api-1.0.5.jar
myfaces-extcdi-message-module-impl-1.0.5.jar
Ideally I would like to be able to use a simple text properties file.
I found one method to change this property. Using this page as a guide:
http://cwiki.apache.org/EXTCDI/jsf-config-and-spi.html
I created the following class:
import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.WindowContextConfig;
#ApplicationScoped
#Specializes
public class CustomWindowContextConfig extends WindowContextConfig {
#Override
public boolean isUrlParameterSupported() {
return false;
}
}
And vitally, I created an empty file named "beans.xml" the WEB-INF folder of my project. We had not been using CDI previously, so did not have this file in place yet.

How to get grails plugin version from app?

How to get grails plugin version from app?
Details: my app is also a grails plugin.
When I set version, using
grails set-version 0.5
I can't get value using grailsApplication.metadata['app.version']
because value is updated in my FooBarGrailsPlugin.groovy class
The application.properties file remains unchanged.
Tks.
When I run set-version, my class change from:
class FooBarGrailsPlugin {
def version = 0.1
}
to
class FooBarGrailsPlugin {
def version = 0.5
}
The following code will print out the name and version of all plugins installed in an app
applicationContext.getBean('pluginManager').allPlugins.each {plugin ->
println "${plugin.name} - ${plugin.version}"
}

Resources